View sourcecode

The following files exists in this folder. Click to view.

phpdoc-cache-file_dc990c119383ed0071c30327f1260fde.dat

1 lines ASCII Unix (LF)
1
O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:"*hash";s:32:"d558d4e3a65b7664238c27c536449e29";s:7:"*path";s:26:"Loader/CPsr4Autoloader.php";s:9:"*source";s:6622:"<?php
/**
 * An example of a general-purpose implementation that includes the optional
 * functionality of allowing multiple base directories for a single namespace
 * prefix.
 * 
 * Added feature to have a default directory for unresolved namespaces.
 *
 * Given a foo-bar package of classes in the file system at the following
 * paths ...
 * 
 *     /path/to/packages/foo-bar/
 *         src/
 *             Baz.php             # Foo\Bar\Baz
 *             Qux/
 *                 Quux.php        # Foo\Bar\Qux\Quux
 *         tests/
 *             BazTest.php         # Foo\Bar\BazTest
 *             Qux/
 *                 QuuxTest.php    # Foo\Bar\Qux\QuuxTest
 * 
 * ... add the path to the class files for the \Foo\Bar\ namespace prefix
 * as follows:
 * 
 *      <?php
 *      // instantiate the loader
 *      $loader = new \Example\Psr4AutoloaderClass;
 *      
 *      // register the autoloader
 *      $loader->register();
 *      
 *      // register the base directories for the namespace prefix
 *      $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src');
 *      $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests');
 * 
 * The following line would cause the autoloader to attempt to load the
 * \Foo\Bar\Qux\Quux class from /path/to/packages/foo-bar/src/Qux/Quux.php:
 * 
 *      <?php
 *      new \Foo\Bar\Qux\Quux;
 * 
 * The following line would cause the autoloader to attempt to load the 
 * \Foo\Bar\Qux\QuuxTest class from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:
 * 
 *      <?php
 *      new \Foo\Bar\Qux\QuuxTest;
 *
 * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
 */

namespace Anax\Loader;

class CPsr4Autoloader
{
    /**
     * An associative array where the key is a namespace prefix and the value
     * is an array of base directories for classes in that namespace.
     *
     * @var array
     */
    protected $prefixes = array();



    /**
     * Register loader with SPL autoloader stack.
     * 
     * @return $this
     */
    public function register()
    {
        spl_autoload_register(array($this, 'loadClass'));
        return $this;
    }



    /**
     * Adds a base directory for a namespace prefix.
     *
     * @param string $prefix The namespace prefix.
     * @param string $base_dir A base directory for class files in the
     * namespace.
     * @param bool $prepend If true, prepend the base directory to the stack
     * instead of appending it; this causes it to be searched first rather
     * than last.
     * @return $this
     */
    public function addNamespace($prefix, $base_dir, $prepend = false)
    {
        // normalize namespace prefix
        $prefix = trim($prefix, '\\') . '\\';

        // normalize the base directory with a trailing separator
        $base_dir = rtrim($base_dir, '/') . DIRECTORY_SEPARATOR;
        $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';

        // initialize the namespace prefix array
        if (isset($this->prefixes[$prefix]) === false) {
            $this->prefixes[$prefix] = array();
        }

        // retain the base directory for the namespace prefix
        if ($prepend) {
            array_unshift($this->prefixes[$prefix], $base_dir);
        } else {
            array_push($this->prefixes[$prefix], $base_dir);
        }

        return $this;
    }



    /**
     * Loads the class file for a given class name.
     *
     * @param string $class The fully-qualified class name.
     * @return mixed The mapped file name on success, or boolean false on
     * failure.
     */
    public function loadClass($class)
    {
        // the current namespace prefix
        $prefix = $class;

        // work backwards through the namespace names of the fully-qualified
        // class name to find a mapped file name
        $relative_class = null;
        while (false !== $pos = strrpos($prefix, '\\')) {

            // retain the trailing namespace separator in the prefix
            $prefix = substr($class, 0, $pos + 1);

            // the rest is the relative class name
            $relative_class = substr($class, $pos + 1);

            // try to load a mapped file for the prefix and relative class
            $mapped_file = $this->loadMappedFile($prefix, $relative_class);

            if ($mapped_file) {
                return $mapped_file;
            }

            // remove the trailing namespace separator for the next iteration
            // of strrpos()
            $prefix = rtrim($prefix, '\\');   
        }

        // try to load a mapped file for the default prefix and relative class
        $mapped_file = $this->loadMappedFile('\\', $relative_class);
        if ($mapped_file) {
            return $mapped_file;
        }

        // never found a mapped file
        return false;
    }



    /**
     * Load the mapped file for a namespace prefix and relative class.
     * 
     * @param string $prefix         The namespace prefix.
     * @param string $relative_class The relative class name.
     *
     * @return mixed Boolean false if no mapped file can be loaded, or the
     * name of the mapped file that was loaded.
     */
    protected function loadMappedFile($prefix, $relative_class)
    {
        // are there any base directories for this namespace prefix?
        if (isset($this->prefixes[$prefix]) === false) {
            return false;
        }

        // look through base directories for this namespace prefix
        foreach ($this->prefixes[$prefix] as $base_dir) {
            // replace the namespace prefix with the base directory,
            // replace namespace separators with directory separators
            // in the relative class name, append with .php
            $file = $base_dir
                  . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class)
                  . '.php';
            $file = $base_dir
                  . str_replace('\\', '/', $relative_class)
                  . '.php';

            // if the mapped file exists, require it
            if ($this->requireFile($file)) {
                // yes, we're done
                return $file;
            }
        }

        // never found it
        return false;
    }



    /**
     * If a file exists, require it from the file system.
     * 
     * @param string $file The file to require.
     * @return bool True if the file exists, false if not.
     */
    protected function requireFile($file)
    {
        if (file_exists($file)) {
            require $file;
            return true;
        }
        return false;
    }
}

";s:19:"*namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:11:"*includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:41:"phpDocumentor\Reflection\IncludeReflector":3:{s:7:"*node";O:27:"PHPParser_Node_Expr_Include":2:{s:11:"*subNodes";a:2:{s:4:"expr";O:28:"PHPParser_Node_Expr_Variable":2:{s:11:"*subNodes";a:1:{s:4:"name";s:4:"file";}s:13:"*attributes";a:2:{s:9:"startLine";i:212;s:7:"endLine";i:212;}}s:4:"type";i:3;}s:13:"*attributes";a:2:{s:9:"startLine";i:212;s:7:"endLine";i:212;}}s:23:"*default_package_name";s:0:"";s:10:"*context";O:41:"phpDocumentor\Reflection\DocBlock\Context":3:{s:12:"*namespace";s:11:"Anax\Loader";s:20:"*namespace_aliases";a:0:{}s:7:"*lsen";s:0:"";}}}}s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:12:"*functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:28:"\Anax\Loader\CPsr4Autoloader";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:"*parent";s:0:"";s:13:"*implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:11:"*abstract";b:0;s:8:"*final";b:0;s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:13:"*properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:8:"prefixes";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:33;s:8:"*types";N;s:10:"*default";s:7:"array()";s:9:"*static";b:0;s:13:"*visibility";s:9:"protected";s:8:"*fqsen";s:38:"\Anax\Loader\CPsr4Autoloader::prefixes";s:7:"*name";s:8:"prefixes";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:133:"An associative array where the key is a namespace prefix and the value
is an array of base directories for classes in that namespace.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:61;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:"*variableName";s:0:"";s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"array";}}}s:7:"*name";s:3:"var";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:10:"*methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:5:{s:8:"register";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:33;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:40:"\Anax\Loader\CPsr4Autoloader::register()";s:7:"*name";s:8:"register";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:42:"Register loader with SPL autoloader stack.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:70;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"$this";}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:12:"addNamespace";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:33;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:3:{s:7:"$prefix";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:7:"$prefix";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:21:"The namespace prefix.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:9:"$base_dir";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:9:"$base_dir";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:50:"A base directory for class files in the
namespace.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:8:"$prepend";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\BooleanDescriptor":0:{}}}s:10:"*default";s:5:"false";s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:8:"$prepend";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:127:"If true, prepend the base directory to the stack
instead of appending it; this causes it to be searched first rather
than last.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:44:"\Anax\Loader\CPsr4Autoloader::addNamespace()";s:7:"*name";s:12:"addNamespace";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:45:"Adds a base directory for a namespace prefix.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:89;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:3:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:7:"$prefix";s:8:"*types";r:119;s:7:"*name";s:5:"param";s:14:"*description";s:21:"The namespace prefix.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:9:"$base_dir";s:8:"*types";r:139;s:7:"*name";s:5:"param";s:14:"*description";s:50:"A base directory for class files in the
namespace.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:2;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:8:"$prepend";s:8:"*types";r:159;s:7:"*name";s:5:"param";s:14:"*description";s:127:"If true, prepend the base directory to the stack
instead of appending it; this causes it to be searched first rather
than last.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"$this";}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:9:"loadClass";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:33;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:6:"$class";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:6:"$class";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:31:"The fully-qualified class name.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:41:"\Anax\Loader\CPsr4Autoloader::loadClass()";s:7:"*name";s:9:"loadClass";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:44:"Loads the class file for a given class name.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:122;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:6:"$class";s:8:"*types";r:234;s:7:"*name";s:5:"param";s:14:"*description";s:31:"The fully-qualified class name.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"mixed";}}}s:7:"*name";s:6:"return";s:14:"*description";s:61:"The mapped file name on success, or boolean false on
failure.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:14:"loadMappedFile";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:33;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:9:"protected";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:7:"$prefix";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:7:"$prefix";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:21:"The namespace prefix.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:15:"$relative_class";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:15:"$relative_class";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:24:"The relative class name.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:46:"\Anax\Loader\CPsr4Autoloader::loadMappedFile()";s:7:"*name";s:14:"loadMappedFile";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:63:"Load the mapped file for a namespace prefix and relative class.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:171;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:7:"$prefix";s:8:"*types";r:295;s:7:"*name";s:5:"param";s:14:"*description";s:21:"The namespace prefix.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:15:"$relative_class";s:8:"*types";r:315;s:7:"*name";s:5:"param";s:14:"*description";s:24:"The relative class name.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"mixed";}}}s:7:"*name";s:6:"return";s:14:"*description";s:94:"Boolean false if no mapped file can be loaded, or the
name of the mapped file that was loaded.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:11:"requireFile";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:33;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:9:"protected";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:5:"$file";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":15:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:5:"$file";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:20:"The file to require.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:43:"\Anax\Loader\CPsr4Autoloader::requireFile()";s:7:"*name";s:11:"requireFile";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:50:"If a file exists, require it from the file system.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:209;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:5:"$file";s:8:"*types";r:383;s:7:"*name";s:5:"param";s:14:"*description";s:20:"The file to require.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\BooleanDescriptor":0:{}}}s:7:"*name";s:6:"return";s:14:"*description";s:38:"True if the file exists, false if not.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:13:"*usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:28:"\Anax\Loader\CPsr4Autoloader";s:7:"*name";s:15:"CPsr4Autoloader";s:12:"*namespace";s:12:"\Anax\Loader";s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:0:"";s:17:"*fileDescriptor";r:1;s:7:"*line";i:53;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"package";s:14:"*description";s:7:"Default";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:"*severity";s:5:"error";s:7:"*code";s:13:"PPC:ERR-50005";s:7:"*line";i:53;s:10:"*context";a:2:{s:11:"{{ value }}";s:2:"""";i:0;s:28:"\Anax\Loader\CPsr4Autoloader";}}}}s:19:"*inheritedElement";N;}}}s:13:"*interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:26:{i:0;a:3:{s:4:"type";s:0:"";s:7:"message";s:22:"instantiate the loader";s:4:"line";i:26;}i:1;a:3:{s:4:"type";s:0:"";s:7:"message";s:23:"register the autoloader";s:4:"line";i:29;}i:2;a:3:{s:4:"type";s:0:"";s:7:"message";s:54:"register the base directories for the namespace prefix";s:4:"line";i:32;}i:3;a:3:{s:4:"type";s:0:"";s:7:"message";s:82:"github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md";s:4:"line";i:48;}i:4;a:3:{s:4:"type";s:0:"";s:7:"message";s:26:"normalize namespace prefix";s:4:"line";i:91;}i:5;a:3:{s:4:"type";s:0:"";s:7:"message";s:54:"normalize the base directory with a trailing separator";s:4:"line";i:94;}i:6;a:3:{s:4:"type";s:0:"";s:7:"message";s:37:"initialize the namespace prefix array";s:4:"line";i:98;}i:7;a:3:{s:4:"type";s:0:"";s:7:"message";s:50:"retain the base directory for the namespace prefix";s:4:"line";i:103;}i:8;a:3:{s:4:"type";s:0:"";s:7:"message";s:28:"the current namespace prefix";s:4:"line";i:124;}i:9;a:3:{s:4:"type";s:0:"";s:7:"message";s:65:"work backwards through the namespace names of the fully-qualified";s:4:"line";i:127;}i:10;a:3:{s:4:"type";s:0:"";s:7:"message";s:37:"class name to find a mapped file name";s:4:"line";i:128;}i:11;a:3:{s:4:"type";s:0:"";s:7:"message";s:53:"retain the trailing namespace separator in the prefix";s:4:"line";i:132;}i:12;a:3:{s:4:"type";s:0:"";s:7:"message";s:35:"the rest is the relative class name";s:4:"line";i:135;}i:13;a:3:{s:4:"type";s:0:"";s:7:"message";s:59:"try to load a mapped file for the prefix and relative class";s:4:"line";i:138;}i:14;a:3:{s:4:"type";s:0:"";s:7:"message";s:62:"remove the trailing namespace separator for the next iteration";s:4:"line";i:145;}i:15;a:3:{s:4:"type";s:0:"";s:7:"message";s:12:"of strrpos()";s:4:"line";i:146;}i:16;a:3:{s:4:"type";s:0:"";s:7:"message";s:67:"try to load a mapped file for the default prefix and relative class";s:4:"line";i:150;}i:17;a:3:{s:4:"type";s:0:"";s:7:"message";s:25:"never found a mapped file";s:4:"line";i:156;}i:18;a:3:{s:4:"type";s:0:"";s:7:"message";s:57:"are there any base directories for this namespace prefix?";s:4:"line";i:173;}i:19;a:3:{s:4:"type";s:0:"";s:7:"message";s:55:"look through base directories for this namespace prefix";s:4:"line";i:178;}i:20;a:3:{s:4:"type";s:0:"";s:7:"message";s:53:"replace the namespace prefix with the base directory,";s:4:"line";i:180;}i:21;a:3:{s:4:"type";s:0:"";s:7:"message";s:54:"replace namespace separators with directory separators";s:4:"line";i:181;}i:22;a:3:{s:4:"type";s:0:"";s:7:"message";s:44:"in the relative class name, append with .php";s:4:"line";i:182;}i:23;a:3:{s:4:"type";s:0:"";s:7:"message";s:37:"if the mapped file exists, require it";s:4:"line";i:190;}i:24;a:3:{s:4:"type";s:0:"";s:7:"message";s:15:"yes, we're done";s:4:"line";i:192;}i:25;a:3:{s:4:"type";s:0:"";s:7:"message";s:14:"never found it";s:4:"line";i:197;}}}s:8:"*fqsen";s:0:"";s:7:"*name";s:19:"CPsr4Autoloader.php";s:12:"*namespace";N;s:10:"*package";s:7:"Default";s:10:"*summary";s:156:"An example of a general-purpose implementation that includes the optional
functionality of allowing multiple base directories for a single namespace
prefix.";s:14:"*description";s:1271:"Added feature to have a default directory for unresolved namespaces.

Given a foo-bar package of classes in the file system at the following
paths ...

    /path/to/packages/foo-bar/
        src/
            Baz.php             # Foo\Bar\Baz
            Qux/
                Quux.php        # Foo\Bar\Qux\Quux
        tests/
            BazTest.php         # Foo\Bar\BazTest
            Qux/
                QuuxTest.php    # Foo\Bar\Qux\QuuxTest

... add the path to the class files for the \Foo\Bar\ namespace prefix
as follows:

     <?php
     // instantiate the loader
     $loader = new \Example\Psr4AutoloaderClass;

     // register the autoloader
     $loader->register();

     // register the base directories for the namespace prefix
     $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src');
     $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests');

The following line would cause the autoloader to attempt to load the
\Foo\Bar\Qux\Quux class from /path/to/packages/foo-bar/src/Qux/Quux.php:

     <?php
     new \Foo\Bar\Qux\Quux;

The following line would cause the autoloader to attempt to load the
\Foo\Bar\Qux\QuuxTest class from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:

     <?php
     new \Foo\Bar\Qux\QuuxTest;";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:3:{s:7:"package";r:446;s:4:"link";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:43:"phpDocumentor\Descriptor\Tag\LinkDescriptor":4:{s:7:"*link";s:90:"https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md";s:7:"*name";s:4:"link";s:14:"*description";s:90:"https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}