src/Autoloader.php
public function registerNS(string $ns, string $path, $standard = Autoloader::PSR4)
    {
        if (!file_exists($path) || !is_dir($path) || !is_readable($path))
            throw new \InvalidArgumentException("Path $path is not readable");

        if ($standard !== Autoloader::PSR0 && $standard !== Autoloader::PSR4 && !is_callable($standard))
            throw new \InvalidArgumentException("Invalid standard: $standard");

        // Strip a leading namespace separator
        $ns = trim($ns, '\\');

        // Get the namespace parts
        $parts = explode('\\', $ns);

        $this->registered_namespaces[$ns] = true;

        // Make sure there is a trailing namespace separator
        if ($ns !== "" && substr($ns, -1, 1) !== '\\')
            $ns .= '\\';

        $ref = &$this->root_namespace;
        foreach ($parts as $part)
        {
            // Registering empty namespace
            if ($part === "")
                break;

            if (!isset($ref['sub_ns'][$part]))
                $ref['sub_ns'][$part] = ['loaders' => [], 'sub_ns' => []];

            $ref = &$ref['sub_ns'][$part];
        }

        $ref['loaders'][] = [
            'ns' => $ns,
            'path' => $path,
            'std' => $standard
        ];
    }
public function registerNS(string $ns, string $path, $standard = Autoloader::PSR4)
    {
        if (!file_exists($path) || !is_dir($path) || !is_readable($path))
            throw new \InvalidArgumentException("Path $path is not readable");

        if ($standard !== Autoloader::PSR0 && $standard !== Autoloader::PSR4 && !is_callable($standard))
            throw new \InvalidArgumentException("Invalid standard: $standard");

        // Strip a leading namespace separator
        $ns = trim($ns, '\\');

        // Get the namespace parts
        $parts = explode('\\', $ns);

        $this->registered_namespaces[$ns] = true;

        // Make sure there is a trailing namespace separator
        if ($ns !== "" && substr($ns, -1, 1) !== '\\')
            $ns .= '\\';

        $ref = &$this->root_namespace;
        foreach ($parts as $part)
        {
            // Registering empty namespace
            if ($part === "")
                break;

            if (!isset($ref['sub_ns'][$part]))
                $ref['sub_ns'][$part] = ['loaders' => [], 'sub_ns' => []];

            $ref = &$ref['sub_ns'][$part];
        }

        $ref['loaders'][] = [
            'ns' => $ns,
            'path' => $path,
            'std' => $standard
        ];
    }
Register a namespace with the autoloader.

@param $ns string The namespace to register
@param $path string The path where to find classes in this namespace
@param $standard mixed Autoloader::PSR4 or Autoloader::PSR0. PSR4 is
used by default. You may also provide a callback
function here that will be used as the loader for
this namespace, rather than the provided PSR-0
and PSR-4 loaders.