Library/Loader.php
private static function _load($class, array $lookup)
    {
        // Split the class name into parts separated by camelCase.
        $parts = preg_split('/(?<=[a-z0-9])(?=[A-Z])/x', $class);
        $partsCount = count($parts);

        foreach ($lookup as $base)
        {
            // Generate the path based on the class name parts.
            $path = $base . '/' . implode('/', array_map('strtolower', $parts)) . '.php';

            // Load the file if it exists.
            if (file_exists($path))
            {
                return include $path;
            }

            // Backwards compatibility patch

            // If there is only one part we want to duplicate that part for generating the path.
            if ($partsCount === 1)
            {
                // Generate the path based on the class name parts.
                $path = $base . '/' . implode('/', array_map('strtolower', array($parts[0], $parts[0]))) . '.php';

                // Load the file if it exists.
                if (file_exists($path))
                {
                    return include $path;
                }
            }
        }

        return false;
    }
private static function _load($class, array $lookup)
    {
        // Split the class name into parts separated by camelCase.
        $parts = preg_split('/(?<=[a-z0-9])(?=[A-Z])/x', $class);
        $partsCount = count($parts);

        foreach ($lookup as $base)
        {
            // Generate the path based on the class name parts.
            $path = $base . '/' . implode('/', array_map('strtolower', $parts)) . '.php';

            // Load the file if it exists.
            if (file_exists($path))
            {
                return include $path;
            }

            // Backwards compatibility patch

            // If there is only one part we want to duplicate that part for generating the path.
            if ($partsCount === 1)
            {
                // Generate the path based on the class name parts.
                $path = $base . '/' . implode('/', array_map('strtolower', array($parts[0], $parts[0]))) . '.php';

                // Load the file if it exists.
                if (file_exists($path))
                {
                    return include $path;
                }
            }
        }

        return false;
    }
private static function _load ( $ class , array $ lookup ) { // Split the class name into parts separated by camelCase. $ parts = preg_split ( '/(?<=[a-z0-9])(?=[A-Z])/x' , $ class ) ; $ partsCount = count ( $ parts ) ; foreach ( $ lookup as $ base ) { // Generate the path based on the class name parts. $ path = $ base . '/' . implode ( '/' , array_map ( 'strtolower' , $ parts ) ) . '.php' ; // Load the file if it exists. if ( file_exists ( $ path ) ) { return include $ path ; } // Backwards compatibility patch // If there is only one part we want to duplicate that part for generating the path. if ( $ partsCount === 1 ) { // Generate the path based on the class name parts. $ path = $ base . '/' . implode ( '/' , array_map ( 'strtolower' , array ( $ parts [ 0 ] , $ parts [ 0 ] ) ) ) . '.php' ; // Load the file if it exists. if ( file_exists ( $ path ) ) { return include $ path ; } } } return false ; }
Load a class based on name and lookup array.

@param   string $class  The class to be loaded (wihtout prefix).
@param   array  $lookup The array of base paths to use for finding the class file.

@return  bool     True if the class was loaded, false otherwise.
@author Maximilian Ruta <mr@xtain.net>
Load a class based on name and lookup array .