baseNamespace = $baseNamespace ?: __NAMESPACE__; $this->inflector = $inflector ?: Inflector::getDefault(); } /** * Creates a session handler locking strategy * * @param string $lockingStrategy The name if the locking strategy * @param SessionHandlerConfig $config The session handler config data * * @return LockingStrategyInterface * * @throws InvalidArgumentException If the locking strategy doesn't exist */ public function factory($lockingStrategy = null, SessionHandlerConfig $config = null) { // If the locking strategy is null, let's give it the name "null" if ($lockingStrategy === null) { $lockingStrategy = 'null'; } // Make sure the locking strategy name provided is a string if (!is_string($lockingStrategy)) { throw new InvalidArgumentException('The session locking strategy ' . 'name must be provided as a string.'); } // Determine the class name of the locking strategy class $classPath = $this->baseNamespace . '\\' . $this->inflector->camel($lockingStrategy) . 'LockingStrategy'; // Make sure the locking strategy class exists if (!class_exists($classPath)) { throw new InvalidArgumentException("There is no session locking " . "strategy named \"{$classPath}\"."); } // Call the factory on the locking strategy class to create it return new $classPath($config->get('dynamodb_client'), $config); } }