public function register()
    {
        spl_autoload_register(function ($class) {
            $prefix = $class;
            while (false !== $pos = strrpos($prefix, '\\')) {
                $prefix = substr($class, 0, $pos + 1);
                $relativeClass = substr($class, $pos + 1);
                $paths = $this->getPaths($prefix);
                if ($paths !== null) {
                    foreach ($paths as $baseDir) {
                        $file = $baseDir.str_replace('\\', DIRECTORY_SEPARATOR, $relativeClass).'.php';
                        if (file_exists($file)) {
                            require $file;

                            return true;
                        }
                    }
                }
                $prefix = rtrim($prefix, '\\');
            }

            return false;
        });
    }
public function register()
    {
        spl_autoload_register(function ($class) {
            $prefix = $class;
            while (false !== $pos = strrpos($prefix, '\\')) {
                $prefix = substr($class, 0, $pos + 1);
                $relativeClass = substr($class, $pos + 1);
                $paths = $this->getPaths($prefix);
                if ($paths !== null) {
                    foreach ($paths as $baseDir) {
                        $file = $baseDir.str_replace('\\', DIRECTORY_SEPARATOR, $relativeClass).'.php';
                        if (file_exists($file)) {
                            require $file;

                            return true;
                        }
                    }
                }
                $prefix = rtrim($prefix, '\\');
            }

            return false;
        });
    }
public function register ( ) { spl_autoload_register ( function ( $ class ) { $ prefix = $ class ; while ( false !== $ pos = strrpos ( $ prefix , '\\' ) ) { $ prefix = substr ( $ class , 0 , $ pos + 1 ) ; $ relativeClass = substr ( $ class , $ pos + 1 ) ; $ paths = $ this -> getPaths ( $ prefix ) ; if ( $ paths !== null ) { foreach ( $ paths as $ baseDir ) { $ file = $ baseDir . str_replace ( '\\' , DIRECTORY_SEPARATOR , $ relativeClass ) . '.php' ; if ( file_exists ( $ file ) ) { require $ file ; return true ; } } } $ prefix = rtrim ( $ prefix , '\\' ) ; } return false ; } ) ; }
Registers the autoloading via SPL.
Registers the autoloading via SPL .