public function load($className)
    {
        if (isset($this->_classes[$className])) {
            $file = $this->_classes[$className];
            if (!is_file($file)) {
                trigger_error(strtr('load `:class` class failed: `:file` is not exists.', [':class' => $className, ':file' => $file]), E_USER_ERROR);
            }

            //either linux or phar://
            if (PHP_EOL === "\n" || $file[0] === 'p') {
                /** @noinspection PhpIncludeInspection */
                require $file;
            } else {
                $this->requireFile($file);
            }

            return true;
        }

        /** @noinspection LoopWhichDoesNotLoopInspection */
        foreach ($this->_namespaces as $namespace => $path) {
            if (strpos($className, $namespace) !== 0) {
                continue;
            }

            $file = $path . strtr(substr($className, strlen($namespace)), '\\', '/') . '.php';
            if (is_file($file)) {
                //either linux or phar://
                if (PHP_EOL === "\n" || $file[0] === 'p') {
                    /** @noinspection PhpIncludeInspection */
                    require $file;
                } else {
                    $this->requireFile($file);
                }

                return true;
            }
        }

        return false;
    }
public function load($className)
    {
        if (isset($this->_classes[$className])) {
            $file = $this->_classes[$className];
            if (!is_file($file)) {
                trigger_error(strtr('load `:class` class failed: `:file` is not exists.', [':class' => $className, ':file' => $file]), E_USER_ERROR);
            }

            //either linux or phar://
            if (PHP_EOL === "\n" || $file[0] === 'p') {
                /** @noinspection PhpIncludeInspection */
                require $file;
            } else {
                $this->requireFile($file);
            }

            return true;
        }

        /** @noinspection LoopWhichDoesNotLoopInspection */
        foreach ($this->_namespaces as $namespace => $path) {
            if (strpos($className, $namespace) !== 0) {
                continue;
            }

            $file = $path . strtr(substr($className, strlen($namespace)), '\\', '/') . '.php';
            if (is_file($file)) {
                //either linux or phar://
                if (PHP_EOL === "\n" || $file[0] === 'p') {
                    /** @noinspection PhpIncludeInspection */
                    require $file;
                } else {
                    $this->requireFile($file);
                }

                return true;
            }
        }

        return false;
    }
public function load ( $ className ) { if ( isset ( $ this -> _classes [ $ className ] ) ) { $ file = $ this -> _classes [ $ className ] ; if ( ! is_file ( $ file ) ) { trigger_error ( strtr ( 'load `:class` class failed: `:file` is not exists.' , [ ':class' => $ className , ':file' => $ file ] ) , E_USER_ERROR ) ; } //either linux or phar:// if ( PHP_EOL === "\n" || $ file [ 0 ] === 'p' ) { /** @noinspection PhpIncludeInspection */ require $ file ; } else { $ this -> requireFile ( $ file ) ; } return true ; } /** @noinspection LoopWhichDoesNotLoopInspection */ foreach ( $ this -> _namespaces as $ namespace => $ path ) { if ( strpos ( $ className , $ namespace ) !== 0 ) { continue ; } $ file = $ path . strtr ( substr ( $ className , strlen ( $ namespace ) ) , '\\' , '/' ) . '.php' ; if ( is_file ( $ file ) ) { //either linux or phar:// if ( PHP_EOL === "\n" || $ file [ 0 ] === 'p' ) { /** @noinspection PhpIncludeInspection */ require $ file ; } else { $ this -> requireFile ( $ file ) ; } return true ; } } return false ; }
Makes the work of autoload registered classes

@param string $className

@return bool
Makes the work of autoload registered classes