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 = isset($config['options']) ? $config['options'] : array(); 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; } }