Neos\Flow\Core\Booting\Scripts::initializeClassLoader PHP Метод

initializeClassLoader() публичный статический Метод

Initializes the Class Loader
public static initializeClassLoader ( Bootstrap $bootstrap ) : void
$bootstrap Neos\Flow\Core\Bootstrap
Результат void
    public static function initializeClassLoader(Bootstrap $bootstrap)
    {
        //        require_once(FLOW_PATH_FLOW . 'Classes/Core/ClassLoader.php');
        $initialClassLoaderMappings = [['namespace' => 'Neos\\Flow\\', 'classPath' => FLOW_PATH_FLOW . 'Classes/', 'mappingType' => ClassLoader::MAPPING_TYPE_PSR4]];
        if ($bootstrap->getContext()->isTesting()) {
            $initialClassLoaderMappings[] = ['namespace' => 'Neos\\Flow\\Tests\\', 'classPath' => FLOW_PATH_FLOW . 'Tests/', 'mappingType' => ClassLoader::MAPPING_TYPE_PSR4];
        }
        $classLoader = new ClassLoader($bootstrap->getContext(), $initialClassLoaderMappings);
        spl_autoload_register([$classLoader, 'loadClass'], true, true);
        $bootstrap->setEarlyInstance(ClassLoader::class, $classLoader);
        if ($bootstrap->getContext()->isTesting()) {
            self::requireAutoloaderForPhpUnit();
            $classLoader->setConsiderTestsNamespace(true);
            require_once FLOW_PATH_FLOW . 'Tests/BaseTestCase.php';
            require_once FLOW_PATH_FLOW . 'Tests/FunctionalTestCase.php';
        }
    }

Usage Example

Пример #1
0
 /**
  * Bootstraps the minimal infrastructure, resolves a fitting request handler and
  * then passes control over to that request handler.
  *
  * @return void
  * @api
  */
 public function run()
 {
     Scripts::initializeClassLoader($this);
     Scripts::initializeSignalSlot($this);
     Scripts::initializePackageManagement($this);
     $this->activeRequestHandler = $this->resolveRequestHandler();
     $this->activeRequestHandler->handleRequest();
 }