public static function autoload($className)
    {
        $thisClass = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);

        $baseDir = __DIR__;

        if (substr($baseDir, -strlen($thisClass)) === $thisClass) {
            $baseDir = substr($baseDir, 0, -strlen($thisClass));
        }

        $className = ltrim($className, '\\');
           // echo "class " . $className;
           // echo '<br/>';
        $fileName  = (dirname($baseDir)) . DIRECTORY_SEPARATOR;
                // echo "file " . $fileName;
                // echo '<br/>';
        if ($lastNsPos = strripos($className, '\\')) {
            $namespace = substr($className, 0, $lastNsPos);
               // echo "ns " . $namespace;
               // echo '<br/>';
            $className = substr($className, $lastNsPos + 1);
               // echo "class " . $className;
               // echo '<br/>';
            $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
               // echo "file " . $fileName;
               // echo '<br/>';
        }
        $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

           // echo "FILE: " . $fileName;

        if (file_exists($fileName)) {
            require $fileName;
        }
    }
public static function autoload($className)
    {
        $thisClass = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);

        $baseDir = __DIR__;

        if (substr($baseDir, -strlen($thisClass)) === $thisClass) {
            $baseDir = substr($baseDir, 0, -strlen($thisClass));
        }

        $className = ltrim($className, '\\');
           // echo "class " . $className;
           // echo '<br/>';
        $fileName  = (dirname($baseDir)) . DIRECTORY_SEPARATOR;
                // echo "file " . $fileName;
                // echo '<br/>';
        if ($lastNsPos = strripos($className, '\\')) {
            $namespace = substr($className, 0, $lastNsPos);
               // echo "ns " . $namespace;
               // echo '<br/>';
            $className = substr($className, $lastNsPos + 1);
               // echo "class " . $className;
               // echo '<br/>';
            $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
               // echo "file " . $fileName;
               // echo '<br/>';
        }
        $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

           // echo "FILE: " . $fileName;

        if (file_exists($fileName)) {
            require $fileName;
        }
    }
public static function autoload ( $ className ) { $ thisClass = str_replace ( __NAMESPACE__ . '\\' , '' , __CLASS__ ) ; $ baseDir = __DIR__ ; if ( substr ( $ baseDir , - strlen ( $ thisClass ) ) === $ thisClass ) { $ baseDir = substr ( $ baseDir , 0 , - strlen ( $ thisClass ) ) ; } $ className = ltrim ( $ className , '\\' ) ; // echo "class " . $className; // echo '<br/>'; $ fileName = ( dirname ( $ baseDir ) ) . DIRECTORY_SEPARATOR ; // echo "file " . $fileName; // echo '<br/>'; if ( $ lastNsPos = strripos ( $ className , '\\' ) ) { $ namespace = substr ( $ className , 0 , $ lastNsPos ) ; // echo "ns " . $namespace; // echo '<br/>'; $ className = substr ( $ className , $ lastNsPos + 1 ) ; // echo "class " . $className; // echo '<br/>'; $ fileName .= str_replace ( '\\' , DIRECTORY_SEPARATOR , $ namespace ) . DIRECTORY_SEPARATOR ; // echo "file " . $fileName; // echo '<br/>'; } $ fileName .= str_replace ( '_' , DIRECTORY_SEPARATOR , $ className ) . '.php' ; // echo "FILE: " . $fileName; if ( file_exists ( $ fileName ) ) { require $ fileName ; } }
PSR-0 autoloader.

Do NOT use if you are using Composer to autoload dependencies.

@todo Delete this if we are requiring Composer for MLPHP.

@param $className
PSR - 0 autoloader .