get('config'); if (! isset($config['session_storage']) || ! is_array($config['session_storage'])) { throw new ServiceNotCreatedException( 'Configuration is missing a "session_storage" key, or the value of that key is not an array' ); } $config = $config['session_storage']; if (! isset($config['type'])) { throw new ServiceNotCreatedException( '"session_storage" configuration is missing a "type" key' ); } $type = $config['type']; $options = $config['options'] ?? []; try { $storage = Factory::factory($type, $options); } catch (SessionException $e) { throw new ServiceNotCreatedException(sprintf( 'Factory is unable to create StorageInterface instance: %s', $e->getMessage() ), $e->getCode(), $e); } return $storage; } /** * Create and return a storage instance (v2 usage). * * @param null|string $canonicalName * @param string $requestedName * @return StorageInterface */ public function createService( ServiceLocatorInterface $services, $canonicalName = null, $requestedName = StorageInterface::class ) { return $this($services, $requestedName); } }