ContainerInteropDoctrine\DriverFactory::createWithConfig PHP Метод

createWithConfig() защищенный Метод

protected createWithConfig ( Interop\Container\ContainerInterface $container, $configKey )
$container Interop\Container\ContainerInterface
    protected function createWithConfig(ContainerInterface $container, $configKey)
    {
        $config = $this->retrieveConfig($container, $configKey, 'driver');
        if (!array_key_exists('class', $config)) {
            throw new OutOfBoundsException('Missing "class" config key');
        }
        if (!is_array($config['paths'])) {
            $config['paths'] = [$config['paths']];
        }
        if (AnnotationDriver::class === $config['class'] || is_subclass_of($config['class'], AnnotationDriver::class)) {
            $this->registerAnnotationLoader();
            $driver = new $config['class'](new CachedReader(new AnnotationReader(), $this->retrieveDependency($container, $config['cache'], 'cache', CacheFactory::class)), $config['paths']);
        } else {
            $driver = new $config['class']($config['paths']);
        }
        if (null !== $config['extension'] && $driver instanceof FileDriver) {
            $locator = $driver->getLocator();
            if (get_class($locator) !== DefaultFileLocator::class) {
                throw new Exception\DomainException(sprintf('File locator must be a concrete instance of %s, got %s', DefaultFileLocator::class, get_class($locator)));
            }
            $driver->setLocator(new DefaultFileLocator($locator->getPaths(), $config['extension']));
        }
        if ($driver instanceof MappingDriverChain) {
            foreach ($config['drivers'] as $namespace => $driverName) {
                if (null === $driverName) {
                    continue;
                }
                $driver->addDriver($this->createWithConfig($container, $driverName), $namespace);
            }
        }
        return $driver;
    }