Register a namespace/directory pair

@param  string $namespace
@param  string $directory
@return Zend_Loader_StandardAutoloader
333475
public function registerNamespace($namespace, $directory)
    {
        $namespace = rtrim($namespace, self::NS_SEPARATOR). self::NS_SEPARATOR;
        $this->namespaces[$namespace] = $this->normalizeDirectory($directory);
        return $this;
    }
325598
protected function registerBundleTypes($path, $namespace)
    {
        $finder = new Finder();
        foreach ($finder->in($path)->name('/Type.php$/')->getIterator() as $file) {
            $className = preg_replace('/.php$/', null, $file->getFilename());

            if ($file->getRelativePath()) {
                $subNamespace = str_replace('/', '\\', $file->getRelativePath());
                $fullyClassName = $namespace.'\\Type\\'.$subNamespace.'\\'.$className;
            } else {
                $fullyClassName = $namespace.'\\Type\\'.$className;
            }

            if (class_exists($fullyClassName)) {
                $ref = new \ReflectionClass($fullyClassName);
                if ($ref->isSubclassOf(Type::class) && $ref->isInstantiable()) {
                    $requiredParams = false;
                    foreach ($ref->getConstructor()->getParameters() as $parameter) {
                        if ($parameter->getClass() && $parameter->getClass()->implementsInterface(DefinitionInterface::class)) {
                            continue 2;
                        }
                    }

                    if ($requiredParams) {
                        $error = sprintf('The graphql type defined in class "%s" is not instantiable because has some required parameters in the constructor.', $fullyClassName);
                        throw new \LogicException($error);
                    }
                    /** @var Type $instance */
                    $instance = $ref->newInstance();
                    TypeRegistry::addTypeMapping($instance->name, $fullyClassName);
                }
            }
        }
    }
393414
public function registerPath($namespace, $path, $prepend = false)
    {
        $namespace = Normalizer::ns($namespace, true);
        $index     = substr($namespace, 0, 4);

        $this->indexes[$index] = true;

        $path = Normalizer::path($path, true);

        if (! isset($this->paths[$namespace])) {
            $this->paths[$namespace] = [];
        }
        if ($prepend) {
            array_unshift($this->paths[$namespace], $path);

            return $this;
        }
        array_push($this->paths[$namespace], $path);

        return $this;
    }
367000
public function addNamespace($namespace, $priority = PriorityQueue::NORMAL)
    {
        $namespace = static::normalise($namespace);

        $this->namespaces->insert($namespace, $priority);

        return $this;
    }
354131
public function registerAll(string $directory, array &$definitions)
    {
        $classMap = $this->findAll($directory);
        foreach ($classMap as $class) {
            $this->register($class, $definitions);
        }
    }
366750
public static function addPath ($path, $namespace = \Twig_Loader_Filesystem::MAIN_NAMESPACE)
    {
        $twigLoader = self::getTwigLoader();
        /* @var $twigLoader \Twig_Loader_Filesystem */
        $twigLoader->addPath($path, $namespace);
    }
1170605
public function registerAutoloaders($dependencyInjector)
    {
        if ($this::DIR != null) {
            $namespace = substr(get_class($this), 0, strripos(get_class($this), '\\'));
            $loader = $dependencyInjector->get('loader');
            $loader->registerNamespaces([$namespace => $this::DIR . '/']);
            $loader->register();
        }
    }
749863
public function register_namespace( $namespace, $paths )
    {
        if ( isset( $this->namespaces[ $namespace ] ) )
        {
            $this->namespaces[ $namespace ] = array_merge(
                $this->namespaces[ $namespace ],
                (array) $paths
            );
        } 
        else 
        {
            $this->namespaces[ $namespace ] = (array) $paths;
            
            // Register PSR_0 as the first autoload filter for every namespace
            $this->register_autoload_filter( $namespace, array( $this, "PSR_0" ) );
        }
    }
184444
public function unregisterNamespace($namespace)
    {
        if (is_string($namespace)) {
            $namespace = (array) $namespace;
        } elseif (!is_array($namespace)) {
            throw new Zend_Loader_Exception('Invalid namespace provided');
        }

        foreach ($namespace as $ns) {
            if (isset($this->_namespaces[$ns])) {
                unset($this->_namespaces[$ns]);
            }
        }
        return $this;
    }
1006335
final public function load($namespace, $resource)
    {
        $allowParent = !$this->defaults->getChanges() && empty($this->instanceof);

        return new PrototypeConfigurator($this, $this->loader, $this->defaults, $namespace, $resource, $allowParent);
    }
823339
protected function buildClassLoader($namespace)
    {
        $template = new Template(__DIR__);
        $template->set('namespace', $namespace);
        
        $script = $template->render('templates/autoload.php');
        $file = "{$this->getBuildDirectory()}/autoload.php";
        
        $this->createFile($file, $script);
        
        return $this;
    }
1193309
public function registerNamespace($identifier, $phpNamespace)
    {
        if (array_key_exists($identifier, $this->namespaces) && $this->namespaces[$identifier] !== $phpNamespace) {
            throw new Exception(sprintf('Namespace identifier "%s" is already registered. Do not re-declare namespaces!', $identifier), 1224241246);
        }
        $this->namespaces[$identifier] = $phpNamespace;
    }
1239888
public function register_namespace( $namespace = '', $base = '' ) {
		if ( $namespace && is_dir( $base ) ) {
			$base                           = rtrim( $base, DIRECTORY_SEPARATOR );
			$this->namespaces[ $namespace ] = $base;
		}
	}
47657
public function loadFile($directory, $namespace, $closure)
    {
        $files = $this->getFiles($directory);

        $classes = [];

        $files->map(function($file) use($closure, $namespace, &$classes, &$files){


            $namespace = str_replace(base_path()."/src", "", $file);
            $namespace = dirname($namespace);
            $namespace = str_replace("/", "\\", $namespace)."\\";


            if (!is_dir($file)) {

                $class = $this->getClassByBasename(basename($file), $namespace);
                $classes[] = $class;
                $files[] = $file;
            }
        });

        foreach ($classes as $class) {

            $closure($class);
        }

    }
220117
public static function loadLoader($directory) {
		$content = scandir($directory);
		foreach($content as $file) {
			if($file=="." || $file==".." || $file==__FILE__) {
				continue;
			} else {
				if(preg_match("~_loader.php$~", $file)) {
					require_once $directory."/".$file;
				}
			}
		}
	}
626723
public function addNamespacesToRegistry($namespaces)
    {
        collect((array) $namespaces)->each(function ($namespace) {
            // Get path from namespace.
            $path = $this->getPathFromNamespace($namespace);

            if (file_exists($path)) {
                // Register each annotations file found in the namespace.
                foreach (Finder::create()->files()->name('*.php')->in($path) as $file) {
                    $this->addFilesToRegistry($file->getRealPath());
                }
            }
        });

        return $this;
    }
400694
public function registerInstance($instance, $namespace = '')
    {
        $this->instances[$namespace] = $instance;
        if (is_object($this->instances[$namespace])) {
            $this->instances[$namespace]->errorMessages = $this->errorMessages;
        }

        return $this;
    }