Return the correct MappingDriver base on the application config

@return XmlDriver|YamlDriver|AnnotationDriver
969666
public function getDriver()
    {
        $config = $this->config;
        if ($this->isLegacy()) {
            $appEntityPath = DIR_APPLICATION . '/' . DIRNAME_CLASSES;
            $reader = $this->app->make('orm/cachedSimpleAnnotationReader');
        } else {
            $appEntityPath = DIR_APPLICATION . '/' . DIRNAME_CLASSES . '/' . DIRNAME_ENTITIES;
            $reader = $this->app->make('orm/cachedAnnotationReader');
        }

        $appDriverSettings = $config->get(CONFIG_ORM_METADATA_APPLICATION);
        $xmlConfig = DIR_APPLICATION . '/' . REL_DIR_METADATA_XML;
        $ymlConfig = DIR_APPLICATION . '/' . REL_DIR_METADATA_YAML;

        // Default setting so it comes first
        if (empty($appDriverSettings) && is_dir($appEntityPath)) {
            return new AnnotationDriver($reader, $appEntityPath);
        } else {
            if ($appDriverSettings === 'xml') {
                if (is_dir($xmlConfig)) {
                    return new XmlDriver($xmlConfig);
                } else {
                    // Fallback to default
                    return new AnnotationDriver($reader, $appEntityPath);
                }
            } else {
                if ($appDriverSettings === 'yaml' || $appDriverSettings === 'yml') {
                    if (is_dir($ymlConfig)) {
                        return new YamlDriver($ymlConfig);
                    } else {
                        // Fallback to default
                        return new AnnotationDriver($reader, $appEntityPath);
                    }
                }
            }
        }
    }
1047529
protected function getDomainMapper()
    {
        if ($this->domainMapper !== null) {
            return $this->domainMapper;
        }

        $this->domainMapper = new Helper\DomainMapper(
            $this->persistenceHandler->contentHandler(),
            $this->persistenceHandler->locationHandler(),
            $this->persistenceHandler->contentTypeHandler(),
            $this->getContentTypeDomainMapper(),
            $this->persistenceHandler->contentLanguageHandler(),
            $this->getFieldTypeRegistry()
        );

        return $this->domainMapper;
    }
436018
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode    = $treeBuilder->root('cache');

        $rootNode->children()
            ->append($this->addSessionSupportSection())
            ->append($this->addDoctrineSection())
            ->append($this->addRouterSection())
            ->append($this->addAnnotationSection())
            ->append($this->addSerializerSection())
            ->append($this->addValidationSection())
            ->append($this->addLoggingSection())
            ->append($this->addDataCollectorSection())
            ->end();

        return $treeBuilder;
    }
245336
public function getDriver() : Driver
    {
        if (is_null($this->driver)) {
            $this->driver = $this->driverFactory->createDriver();
            $this->driver->connect();
        }

        return $this->driver;
    }
1061980
public function getUserProviderMapper()
    {
        if ($this->userProviderMapper == null) {
            $this->userProviderMapper = $this->getServiceManager()->get('playgrounduser_userprovider_mapper');
        }

        return $this->userProviderMapper;
    }
1066946
public function getDriver()
    {
        if (null === $this->driver) {
            $this->driver = $this->autodetectDriver($this->knownDrivers);
        }
        return $this->driver;
    }
405957
final protected function getAnnotationReader(): Reader
    {
        $driver = $this->entityManager->getConfiguration()->getMetadataDriverImpl();
        if ($driver instanceof AnnotationDriver) {
            return $driver->getReader();
        }

        if ($driver instanceof MappingDriverChain) {
            return new MappingDriverChainAdapter($driver);
        }

        throw new Exception('graphql-doctrine requires Doctrine to be configured with a `' . AnnotationDriver::class . '`.');
    }
624026
public function getDriver(string $driver): Autowire
    {
        if (!$this->hasDriver($driver)) {
            throw new ConfigException("Undefined driver `{$driver}`");
        }

        $config = $this->config['connections'][$driver] ?? $this->config['drivers'][$driver];

        if ($config instanceof Autowire) {
            return $config;
        }

        return new Autowire(
            $config['driver'] ?? $config['class'],
            ['options' => $config['options'] ?? $config]
        );
    }
1291957
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('open_orchestra_front');

        $rootNode->children()
            ->arrayNode('devices')
                ->useAttributeAsKey('name')
                ->prototype('array')
                    ->children()
                        ->scalarNode('parent')->defaultNull()->end()
                    ->end()
                ->end()
            ->end()
            ->append($this->addTemplateSetConfiguration())
            ->scalarNode('device_type_field')->defaultValue('x-ua-device')->end()
        ->end();

        return $treeBuilder;
    }
630938
protected function getUserMapper()
    {
        if ( null === $this->_userMapper )
        {
            $mapper = $this->getMapper();

            $this->_userMapper = $this->getServiceLocator()
                                      ->get( 'Di' )
                                      ->get( 'Grid\User\Model\User\Mapper', array(
                                          'dbAdapter' => $mapper->getDbAdapter(),
                                          'dbSchema'  => $mapper->getDbSchema(),
                                      ) );
        }

        return $this->_userMapper;
    }
1237641
public function getDriverManager(): Interfaces\JavaObject
    {
        if ($this->driverManager === null) {
            $this->driverManager = $this->ba->javaClass('java.sql.DriverManager');
        }

        return $this->driverManager;
    }
187535
public function getDriver() {
        if ($this->_driver) {
            return $this->_driver;
        }

        return $this->_driver = $this->getDatabase()->getDriver($this->getConnectionKey());
    }
992523
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root( 'userfriendly_social_user' );

        $supportedDrivers = array( 'orm' );
        //$supportedDrivers = array( 'orm', 'mongodb' );

        $rootNode
            ->children()
                ->scalarNode( 'db_driver' )
                    ->validate()
                        ->ifNotInArray( $supportedDrivers )
                        ->thenInvalid( 'The driver %s is not supported. Please choose one of ' . json_encode( $supportedDrivers ))
                    ->end()
                    ->cannotBeOverwritten()
                    ->isRequired()
                    ->cannotBeEmpty()
                ->end()
                ->scalarNode( 'firewall_name' )->isRequired()->cannotBeEmpty()->end()
                ->scalarNode( 'user_class' )->isRequired()->cannotBeEmpty()->end()
                ->scalarNode( 'user_identity_class' )->defaultNull()->end()
                ->scalarNode( 'group_class' )->defaultNull()->end()
                ->scalarNode( 'model_manager_name' )->defaultNull()->end()
                ->scalarNode( 'mailsubject_emailchange' )->end()
                ->scalarNode( 'mailsubject_accountdetails' )->end()
            ->end();

        $this->defineResourceOwnerConfig( $rootNode );

        return $treeBuilder;
    }
1103983
public function getDriverName()
    {
        $value = $this->getValue();

        $value = explode(":", $value);

        $driver = reset($value);

        return $driver;
    }
29428
public function getConfigTreeBuilder ()
    {
        $treeBuilder = new TreeBuilder();
        $root = $treeBuilder->root("becklyn_static_roles");

        $root
            ->children()
                ->arrayNode("roles")
                    ->useAttributeAsKey("role")
                    ->prototype('array')
                        ->children()
                            ->scalarNode("title")->isRequired()->end()
                            ->scalarNode("description")->end()
                            ->booleanNode("hidden")->defaultFalse()->end()
                            ->arrayNode("included_roles")
                                ->prototype('scalar')->end()
                            ->end()
                            ->arrayNode("tags")
                                ->prototype('scalar')->end()
                            ->end()
                            ->arrayNode("actions")
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
955613
public function getSerialyser() {
       $serialyser = $this->getServiceLocator()->get($this->serialyserList[$this->driverName]);
       $serialyser->setServiceLocator($this->serviceLocator)->setDriverEscaper($this->driverEscaper)->setOptions($this->options)->prefixQuery();
       return $serialyser;
    }
311176
public function getConfigTreeBuilder()
    {
        $builder = new TreeBuilder();

        $builder
            ->root('alchemy_embed')
                ->children()
                    ->arrayNode('exceptions')
                        ->addDefaultsIfNotSet()
                        ->children()
                            ->arrayNode('content_types')
                                ->fixXmlConfig('content_type')
                                ->addDefaultChildrenIfNoneSet()
                                ->prototype('scalar')
                                    ->defaultValue('application/json')
                                ->end()
                            ->end()
                            ->scalarNode('enabled')->defaultTrue()->end()
                            ->scalarNode('transformer')->defaultNull()->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $builder;
    }