Registers Pheanstalk_ClassLoader as an SPL class loader.
Inserts self first, retains existing loaders and __autoload()

@param string $path Path to Pheanstalk classes directory
356959
public static function register($path)
	{
		self::$_path = $path;
		self::addPath($path);

		if ($loaders = spl_autoload_functions())
			array_map('spl_autoload_unregister', $loaders);
		else
			$loaders = function_exists('__autoload') ? array('__autoload') : array();

		array_unshift($loaders, array(__CLASS__, 'load'));
		array_map('spl_autoload_register', $loaders);
	}
131782
public function autoload($classpath)
    {
        $this->_registeredNamespace = false;

        list($namespace, $classname) = $this->normalizeClassname($classpath);

        if ($this->autoloadThrowWrappers($namespace, $classname) || $this->autoloadThrowFilesystem($namespace, $classname)) {
            if (NAMESPACE_SEPARATOR == substr($classpath, 0, 1)) {
                $classpath = substr($classpath, 1);
            }

            if (null !== $this->getEventDispatcher() && is_subclass_of($classpath, 'BackBee\ClassContent\AbstractClassContent')) {
                $this->getEventDispatcher()->triggerEvent('include', new $classpath());
            }

            return;
        }

        if (true === $this->_registeredNamespace) {
            throw new Exception\ClassNotFoundException(sprintf('Class %s%s%s not found.', $namespace, NAMESPACE_SEPARATOR, $classname));
        }
    }
312851
public function load($path)
    {
        $tests = $this->getTests($path);
        $this->eventEmitter->emit('peridot.concurrency.load', [$tests]);
    }
879839
public function registerModules(string $filePath = null)
    {
        is_file($filePath) || $filePath = App::getBasePath() . $filePath;

        if (is_file($filePath)) {
            /** @var Registry $modules */

            /** @noinspection PhpIncludeInspection */
            $modules = require_once $filePath;

            $modules = is_array($modules) ? $modules : [];

            foreach ($modules as $module) {
                IOC::resolve('Modules')->register($module);
            }

            Event::dispatch('minimal.loaded.modules', [$filePath, $modules]);
        }
    }
1033719
public function registerApplication($name, $path, $bootstrap = false)
    {
        $this->_applications[$name] = $path;

        //Register the components for bootstrapping
        if($bootstrap)
        {
            $this->registerComponents($path);
            $this->getObject('manager')->getClassLoader()->setBasePath($path);
        }

        return $this;
    }
1374513
public function addPsr4($class, $path = null)
    {
        if (is_array($class)) {
            foreach ($class as $ns => $path) {
                $this->psr4->addNamespace($ns, $path);
            }
        } else {
            $this->psr4->addNamespace($class, $path);
        }

        return $this;
    }
745326
public function register($class, string $path = '')
    {
        if (empty($class->slug)) {
            return;
        }

        if (!is_multisite() && $class->multisiteOnly) {
            return;
        }

        // Get post type slug
        $postTypeSlug = self::prefixSlug($class->slug);
        self::$classes[$postTypeSlug] = $class;

        // Set labels
        $labels = array(
            'name'               => _x($class->nameSingular, 'post type general name', 'modularity'),
            'singular_name'      => _x($class->nameSingular, 'post type singular name', 'modularity'),
            'menu_name'          => _x($class->namePlural, 'admin menu', 'modularity'),
            'name_admin_bar'     => _x($class->nameSingular, 'add new on admin bar', 'modularity'),
            'add_new'            => _x('Add New', 'add new button', 'modularity'),
            'add_new_item'       => sprintf(__('Add new %s', 'modularity'), $class->nameSingular),
            'new_item'           => sprintf(__('New %s', 'modularity'), $class->nameSingular),
            'edit_item'          => sprintf(__('Edit %s', 'modularity'), $class->nameSingular),
            'view_item'          => sprintf(__('View %s', 'modularity'), $class->nameSingular),
            'all_items'          => sprintf(__('Edit %s', 'modularity'), $class->namePlural),
            'search_items'       => sprintf(__('Search %s', 'modularity'), $class->namePlural),
            'parent_item_colon'  => sprintf(__('Parent %s', 'modularity'), $class->namePlural),
            'not_found'          => sprintf(__('No %s', 'modularity'), $class->namePlural),
            'not_found_in_trash' => sprintf(__('No %s in trash', 'modularity'), $class->namePlural)
        );

        // Set args
        $args = array(
            'labels'               => $labels,
            'description'          => __($class->description, 'modularity'),
            'public'               => false,
            'publicly_queryable'   => false,
            'exclude_from_search'  => false,
            'show_ui'              => true,
            'show_in_nav_menus'    => false,
            'show_in_menu'         => ($this->showInAdminMenu()) ? 'modularity' : false,
            'has_archive'          => false,
            'rewrite'              => false,
            'hierarchical'         => false,
            'menu_position'        => 100,
            'menu_icon'            => $class->icon,
            'supports'             => array_merge($class->supports, array('title', 'revisions', 'author')),
            'capabilities'         => array(
                'edit_post'          => 'edit_module',
                'edit_posts'         => 'edit_modules',
                'edit_others_posts'  => 'edit_other_modules',
                'publish_posts'      => 'publish_modules',
                'read_post'          => 'read_module',
                'read_private_posts' => 'read_private_posts',
                'delete_post'        => 'delete_module'
            ),
            'map_meta_cap'         => true
        );

        //Disable from search search pages (someone did a huge mistake designing this feature)
        if (is_search()) {
            $args['exclude_from_search'] = true;
        }

        // Get menu icon
        if (empty($args['menu_icon']) && $icon = $this->getIcon($path, $class)) {
            $args['menu_icon'] = $icon;
            $args['menu_icon_auto_import'] = true;
        }

        // Register the post type if module is enabled
        if (in_array($postTypeSlug, self::$enabled)) {

            register_post_type($postTypeSlug, $args);
            $this->setupListTableField($postTypeSlug);

            $class->plugin = (array) $class->plugin;

            if (!empty($class->plugin)) {
                // Fallback to enable old modules to register their plugins
                if (!is_array($class->plugin)) {
                    $class->plugin = array($class->plugin);
                }

                // Ability to filter path
                $class->plugin = apply_filters('Modularity/Register/Plugin', $class->plugin, $postTypeSlug);

                // Include
                foreach ($class->plugin as $plugin) {
                    /**
                     * Deprecated
                     * @todo  Remove……
                     */
                    trigger_error('Deprecation message: Modularity module "' . $postTypeSlug . '" is using a deprecated way of including plugins. Use the wp action "Modularity/Plugins" to load plugins instead.', E_USER_WARNING);

                    if (file_exists($plugin)) {
                        require_once $plugin;
                    } elseif (file_exists(MODULARITY_PATH . 'plugins/'. $plugin)) {
                        require_once MODULARITY_PATH . 'plugins/'. $plugin;
                    }
                }
            }
        }

        // Check if module is deprecated
        if ($class->isDeprecated) {
            \Modularity\ModuleManager::$deprecated[] = $postTypeSlug;
        }

        // Add to list of available modules
        \Modularity\ModuleManager::$available[$postTypeSlug] = $args;

        // Store settings of each module in static var
        self::$moduleSettings[$postTypeSlug] = array(
            'moduleSlug'    => $postTypeSlug,
            'slug'          => $class->slug,
            'singular_name' => $class->nameSingular,
            'plural_name'   => $class->namePlural,
            'description'   => $class->description,
            'supports'      => $class->supports,
            'icon'          => $class->icon,
            'plugin'        => $class->plugin,
            'cache_ttl'     => $class->cacheTtl,
            'hide_title'    => $class->hideTitle
        );

        $class->moduleSlug = $postTypeSlug;

        return $postTypeSlug;
    }
888815
private function initPackageClassPhp($path, $packageName)
    {
        $class = $this->getClass($packageName);
        $namespace = $this->getNamespace($packageName);
        $file = $path.'/src/'.$class.'.php';
        if (file_exists($file)) {
            return;
        }
        $code = file_get_contents(__DIR__.'/../../tpl/PackageClass.php.txt');
        $code = str_replace(['%%CLASS%%', '%%NAMESPACE%%'], [$class, $namespace], $code);
        if (!is_dir($path.'/src')) {
            mkdir($path.'/src');
        }
        file_put_contents($file, $code);
    }
242667
public function addPath($path)
    {
        try {
            $this->twigFileLoader->addPath($path);
        } catch (\Twig_Error_Loader $e) {
            throw new InvalidPathException($e->getMessage());
        }
    }
1065098
public function register(string $path, array $data = [], $package = null)
    {
        $packageResolver = $this->getPackageResolver();

        if ($package && !$package instanceof AbstractPackage) {
            $package = $packageResolver->getPackage($package);
        }

        // Workaround that RouteCreator should always be new one.
        $routerCreator = new RouteCreator($packageResolver);

        $routerCreator
            ->group('root')
            ->setOptions($data)
            ->register(function (RouteCreator $router) use ($path) {
                $router->load($path);
            });

        // TODO: Maybe move this handler to outside that support register() twice wothout side effect.
        foreach ($routerCreator->getRoutes() as $name => $route) {
            $route = $this->routeCreator->handleRoute($route);

            $this->addRouteByConfig(
                $route->getName(),
                $route->getOptions(),
                $package ?: $route->getOption('package')
            );
        }

        return $this;
    }
835041
public function registerPath($path, $highPriority = true)
    {
        if ($highPriority) {
            array_unshift($this->paths, $path);
        } else {
            array_push($this->paths, $path);
        }
        return $this;
    }
1194241
public static function initialize(?string $path = null): void
    {
        if (self::$isLoaded === true) {
            return;
        }

        // Load dotenv.
        self::$path = $path;
        if (self::$path === null) {
            self::$path = Path::root();
        }
        if (File::exist(self::$path . '/.env')) {
            self::$dotenv = new Dotenv(self::$path);
            self::$dotenv->load();
        }

        // Initialize repositories.
        if (!is_array(self::$repositories)) {
            self::$repositories = [];
        }

        self::$isLoaded = true;
    }
276401
protected function registerAutoload($theme)
	{
        $composer = require(base_path('vendor/autoload.php'));
        
        $class = 'Themes\\'.$theme.'\\';
        $path  = $this->path('src/');

        if (! array_key_exists($class, $composer->getClassMap())) {
            $composer->addPsr4($class, $path);
        }
	}
1235630
public function registerProviders(string $filePath = null)
    {
        is_file($filePath) || $filePath = App::getBasePath() . $filePath;

        if (is_file($filePath)) {
            /** @noinspection PhpIncludeInspection */
            $providers = require_once $filePath;

            $providers = is_array($providers) ? $providers : [];

            IOC::addProviders($providers);

            Event::dispatch('minimal.loaded.providers', [$filePath, $providers]);
        }
    }
428733
public static function registerModulePath($path)
    {
        if (file_exists($path)) {
            self::$_modulePaths[] = $path;
        } else {
            user_error(__d('wasabi_cms', 'Module path {0} does not exist.', $path));
        }
    }
1263735
private function addAutoload($phar)
    {
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/autoload.php'));
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/autoload_classmap.php'));
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/autoload_files.php'));
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/autoload_namespaces.php'));
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/autoload_psr4.php'));
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/autoload_real.php'));
        if (file_exists($this->path . '/vendor/composer/include_paths.php')) {
            $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/include_paths.php'));
        }
        $this->addFile($phar, new \SplFileInfo($this->path . '/vendor/composer/ClassLoader.php'));

        /* add react/promise */
        $react = new Finder();
        $react->files()->ignoreVCS(true)->ignoreDotFiles(true)->name('*.php')->in($this->path . '/vendor/react/promise/src');
        foreach ($react as $file) {
            $this->addFile($phar, $file);
        }
    }
255490
public function load(string $path = '')
    {
        if ($path) {
            $testFileLoader = new TestFileLoader($this->options);
            $this->files = array_merge(
                $this->files,
                $testFileLoader->loadPath($path)
            );
        } elseif (
            isset($this->options->parallelSuite)
            && $this->options->parallelSuite
        ) {
            $this->suitesName = $this->configuration->getSuitesName();
        } elseif ($this->configuration->hasSuites()) {
            if (!empty($this->options->testsuite)) {
                $suites = [];
                foreach ($this->options->testsuite as $testsuite) {
                    $suites = array_merge($suites, $this->configuration->getSuiteByName($testsuite));
                }
            } else {
                $suites = $this->configuration->getSuites();
            }

            foreach ($suites as $suite) {
                foreach ($suite as $suitePath) {
                    $testFileLoader = new TestFileLoader($this->options);
                    $this->files = array_merge(
                        $this->files,
                        $testFileLoader->loadSuitePath($suitePath)
                    );
                }
            }
        }

        if (!$this->files && !\is_array($this->suitesName)) {
            throw new \RuntimeException('No path or configuration provided (tests must end with Test.php)');
        }

        $this->files = array_unique($this->files); // remove duplicates

        $this->initSuites();
    }