Register many namespace/directory pairs at once

@param  array $namespaces
@return Zend_Loader_StandardAutoloader
767778
public function registerNamespaces($namespaces)
    {
        if (!is_array($namespaces) && !$namespaces instanceof Traversable) {

            throw new Zend_Loader_Exception_InvalidArgumentException('Namespace pairs must be either an array or Traversable');
        }

        foreach ($namespaces as $namespace => $directory) {
            $this->registerNamespace($namespace, $directory);
        }
        return $this;
    }
1245108
public function setNumSpaces(int $numSpaces): self
    {
        $this->spaces = \str_repeat(' ', $numSpaces);
        $this->numSpaces = $numSpaces;

        return $this;
    }
1223632
public function setNamespaceAliases(array $namespace_aliases)
    {
        $this->namespace_aliases = array();
        foreach ($namespace_aliases as $alias => $fqnn) {
            $this->setNamespaceAlias($alias, $fqnn);
        }
        return $this;
    }
953140
public function addFilesToRegistry($filePaths)
    {
        collect((array) $filePaths)->each(function ($filePath) {
            if (file_exists($filePath)) {
                AnnotationRegistry::registerFile($filePath);
            }
        });

        return $this;
    }
611770
public static function registerNamespace($namespace, $path, $classname = null)
    {
        $namespace = trim($namespace, '\\');
        $path = rtrim($path, '/\\');

        $loader = function ($classname, $return_filename = false) use ($namespace, $path) {
            if (class_exists($classname, false) || interface_exists($classname, false)) {
                return true;
            }

            $classname = trim($classname, '\\');

            if ($namespace && stripos($classname, $namespace) !== 0) {
                return false;
            } else {
                $filename = trim(substr($classname, strlen($namespace)), '\\');
            }

            $filename = $path . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $filename) . '.php';

            if ($return_filename) {
                return $filename;
            } else {
                if (!file_exists($filename)) {
                    return false;
                }

                require $filename;

                return class_exists($classname, false) || interface_exists($classname, false);
            }
        };

        if ($classname === null) {
            spl_autoload_register($loader);
        } else {
            return $loader($classname, true);
        }
    }
364313
public function setPaths($paths, $namespace = self::DEFAULT_NAMESPACE)
    {
        if (! is_array($paths)) {
            $paths = [$paths];
        }
        $this->paths[$namespace] = [];
        foreach ($paths as $path) {
            $this->addPath($path, $namespace);
        }
    }
162445
private function addNamespaces( $additionalNamespaces )
	{
		// Load any additional namespaces
		foreach ( $additionalNamespaces as $namespaces )
		{
			if ( is_null( $namespaces ) || ! is_array( $namespaces ) )
			{
				continue;
			}

			foreach ( $namespaces as $prefix => $namespace )
			{
				if ( empty( $prefix ) ) continue;
				$this->nsMgr->addNamespace( $prefix, $namespace );
			}
		}
	}
463857
protected function namespaceCreateAllDir(string $namespace){
        if ( is_dir($namespace)) return;
        $dirList = explode('\\' , str_replace('/' , '\\' , $namespace));
        $path = $this->annotationConfig->getConfig()['buildPath'];
        foreach ($dirList as $k => $dir){
            $path .=  '/' . $dir;
            // if not existed create the dir
            if ( !is_dir($path)) mkdir($path);
        }
    }
1000441
public function registerNamespace($namespace, $paths)
    {
        if (false === isset($this->_namespaces[$namespace])) {
            $this->_namespaces[$namespace] = array();
        }

        $this->_namespaces[$namespace] = array_merge($this->_namespaces[$namespace], (array) $paths);

        return $this;
    }
216873
private function getPathMap (array $namespaces) : array
    {
        $pathMap = [];

        foreach ($namespaces as $namespace => $path)
        {
            $pathMap[$path] = 1 + ($pathMap[$path] ?? 0);
        }

        return $pathMap;
    }
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;
    }
360499
public function setNamespace($namespace)
	{
	    $this->namespace = rtrim($namespace, '\\');
	    
	    // set autoload
	    if ($this->namespace) {
	        Ioc::loader()->setPsr4($this->namespace, $this->basePath . 'src');
	    }
	    
	    return $this;
	}
347552
public function bootGedmoExtensions($namespaces = ['App'], $all = true)
    {
        if ($all) {
            DoctrineExtensions::registerMappingIntoDriverChainORM(
                $this->chain,
                $this->reader
            );
        } else {
            DoctrineExtensions::registerAbstractMappingIntoDriverChainORM(
                $this->chain,
                $this->reader
            );
        }

        $driver = $this->metadata->getMetadataDriverImpl();
        foreach ($namespaces as $namespace) {
            $this->chain->addDriver($driver, $namespace);
        }
        $this->metadata->setMetadataDriverImpl($this->chain);

        $this->dispatcher->fire('doctrine.driver-chain::booted', [
            $driver,
            $this->chain
        ]);
    }
234771
protected function listPackageClasses(array $namespaces)
    {
        return array_filter(get_declared_classes(), function ($class) use ($namespaces) {
            $valid = false;
            foreach ($namespaces as $ns) {
                $valid = (strpos($class, $ns) === 0) ? true : $valid;
            }
            return $valid;
        });
    }
1145014
private function registerAnnotations(array $annotations)
    {
        $kernel = $this
            ->container
            ->get('kernel');

        foreach ($annotations as $annotation) {
            AnnotationRegistry::registerFile($kernel
                ->locateResource($annotation)
            );
        }
    }
1021425
public static function extractNamespaces(ClassLoader $classLoader) {
    $namespaces = [];
    foreach ($classLoader->getPrefixes() as $namespace => $directories) {
      $namespaces[$namespace] = $directories[0];
    }
    foreach ($classLoader->getPrefixesPsr4() as $namespace => $directories) {
      $namespaces[$namespace] = $directories[0];
    }
    return new \ArrayIterator($namespaces);
  }
961987
public function factory($namespace, array $args = [])
    {
        $namespace = $this->checkOverrider($namespace);

        $this->classExists($namespace)
            ->callEvent('register_before_create', [$namespace, $args]);

        try {
            $object = new $namespace(...$args);
        } catch (\Exception $exception) {
            throw new RegisterException($exception);
        }

        $this->callEvent('register_after_create', [$object]);

        $this->setClassCounter($namespace);
        $this->registeredObjects[$namespace] = get_class($object);

        $this->makeLog([
            'Object created: ' . $namespace . '. With args:',
            $args
        ]);

        return $object;
    }