Register the package's component namespaces.

@param  string  $package
@param  string  $namespace
@param  string  $path
@return void
330777
public function package($package, $namespace = null, $path = null)
	{
		$namespace = $this->getPackageNamespace($package, $namespace);

		$path = $path ?: $this->guessPackagePath();

		//ChangeLog: Configuration setup removed


		// Next we will check for any "language" components. If language files exist
		// we will register them with this given package's namespace so that they
		// may be accessed using the translation facilities of the application.
		$lang = $path.'/lang';

		if ($this->app['files']->isDirectory($lang))
		{
			$this->app['translator']->addNamespace($namespace, $lang);
		}

		// Next, we will see if the application view folder contains a folder for the
		// package and namespace. If it does, we'll give that folder precedence on
		// the loader list for the views so the package views can be overridden.
		$appView = $this->getAppViewPath($package);

		if ($this->app['files']->isDirectory($appView))
		{
			$this->app['view']->addNamespace($namespace, $appView);
		}

		// Finally we will register the view namespace so that we can access each of
		// the views available in this package. We use a standard convention when
		// registering the paths to every package's views and other components.
		$view = $path.'/views';

		if ($this->app['files']->isDirectory($view))
		{
			$this->app['view']->addNamespace($namespace, $view);
		}
	}
695029
public function register($namespace=null, $path = null, $psr4=false)
    {
        $this->load_ns[$namespace] = array($path, $psr4);
        if ($this->registered) { 
            return;
        }
        spl_autoload_register(array($this,"spl_autoload_callback"));
        $this->registered = true;
    }
1065098
public function register(string $path, array $data = [], $package = null)
    {
        $packageResolver = $this->getPackageResolver();

        if ($package && !$package instanceof AbstractPackage) {
            $package = $packageResolver->getPackage($package);
        }

        // Workaround that RouteCreator should always be new one.
        $routerCreator = new RouteCreator($packageResolver);

        $routerCreator
            ->group('root')
            ->setOptions($data)
            ->register(function (RouteCreator $router) use ($path) {
                $router->load($path);
            });

        // TODO: Maybe move this handler to outside that support register() twice wothout side effect.
        foreach ($routerCreator->getRoutes() as $name => $route) {
            $route = $this->routeCreator->handleRoute($route);

            $this->addRouteByConfig(
                $route->getName(),
                $route->getOptions(),
                $package ?: $route->getOption('package')
            );
        }

        return $this;
    }
225548
private static function _parseAdditions(array &$components, $namespace, $path)
    {
        if (!file_exists($path)) {
            return;
        }
        foreach (new \DirectoryIterator($path) as $object) {
            if ($object->isDot() || $object->isDir()) {
                continue;
            }
            $components[$namespace][lcfirst(substr($object->getFilename(), 0, -4))] = substr($object->getFilename(), -3) == 'php' ? 1 : $object->getPathname();
        }
    }
565287
public function addConfigComponent($package, $namespace, $path)
    {
        if ($this->hasPackageRepository()) {
            $this->app->make('config')->package($package, $path, $namespace);
        }
    }
385585
public static function registerPackage(PackageInterface $package, $target, AssetsInstallerInterface $installer = null)
    {
        $_this = self::getInstance($installer);
        $_this->addPackage($package, $target);
    }
702582
public function addPath($namespace, $path, $prepend = false) {
		if($namespace === null) {
			$namespace = '_';
		}
		if(!isset($this->paths[$namespace])) {
			$this->paths[$namespace] = [];
		}
		if($prepend) {
			array_unshift($this->paths[$namespace], $path);
		} else {
			array_push($this->paths[$namespace], $path);
		}
	}
1202591
public function installPackageDir($package, $namespace, $packageAssetsDir)
    {
        $this->log($package->getTarget(), self::LOG_INFO, self::CODE_INSTALLING_DIR, array('namespace' => $namespace));
        if (!isset($this->assetsDirectories[$namespace])) {
            $this->log($package->getTarget(), self::LOG_WARNING, self::CODE_NO_MATCHING_DIR, array('namespace' => $namespace));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 0;
            return;
        }
        $this->log($package->getTarget(), self::LOG_INFO, self::CODE_MATCHING_DIR, array('namespace' => $namespace));
        // We get the project vendor path
        $vendorPath = $this->getVendorPath();
        // We get the target dir of the iterated package
        $targetDir = $package->getTarget();
        // We get the full path of the current assets directory
        $packagePath = $vendorPath
            . $targetDir . "/" . $packageAssetsDir;
        // We check if this path is a directory
        if ($this->directoryHandler->isDirectory($packagePath)) {
            $this->log($package->getTarget(), self::LOG_INFO, self::CODE_DIRECTORY, array('directory' => $this->assetsDirectories[$namespace]));
            $src = $packagePath;
            $dst = $vendorPath . "../" . $this->assetsDirectories[$namespace] . $targetDir;
            // We delete the remaining directory if any
            // In order to update it
            $this->directoryHandler->deleteDirectory($dst);
            // We finally copy the package assets-dir
            // Into the project assets-dir
            $this->directoryHandler->copyDirectory($src, $dst);
            $this->log($package->getTarget(), self::LOG_INFO, self::CODE_DIR_INSTALLED, array('destination' => $dst));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 1;
        } else {
            $this->log($package->getTarget(), self::LOG_ERROR, self::CODE_NOT_DIRECTORY, array('directory' => $this->assetsDirectories[$namespace]));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 0;
        }
    }
94996
public function setPathForNamespace($namespace, $path)
    {
        $unifiedNamespace = $this->unifyNamespace($namespace);
        if (!preg_match('/^[a-zA-Z0-9_\\\]{3,}$/', $unifiedNamespace)) {
            throw new InvalidArgumentException("Invalid namespace {$namespace}");
        }

        $this->namespaces[$unifiedNamespace] = $path;

        return $this;
    }
193950
protected function routesRegister(string $file, string $namespace)
    {
        $this->app->router->group([
            'namespace' => $namespace,
        ], function ($router) use ($file) {
            require $file;
        });
    }
580189
public function register($namespace, $includePath)
    {
        if (array_key_exists($namespace, $this->includePaths)) {
            throw new \Exception("Error: Namespace '$namespace' is already registered!");
        }

        $this->includePaths[$namespace] = rtrim($includePath, DS) . DS;
    }
1348595
public static function registerNamespace($namespace, $prepend = false)
    {
        if (false === $prepend) {
            self::$namespaces[] = $namespace;
        } else {
            array_unshift(self::$namespaces, $namespace);
        }
    }
565373
protected function loadViewsFrom( $path, $namespace )
	{
		if ( is_dir( $appPath = Framework::fw()->basePath . '/resources/views/vendor/' . $namespace ) )
			Framework::get( 'view' )->addNamespace( $namespace, $appPath );

		Framework::get( 'view' )->addNamespace( $namespace, $path );
	}
651167
public function registerXPathNamespace($prefix, $uri)
    {
        $this->el->registerXPathNamespace($prefix, $uri);
        $this->namespaces[$prefix] = $uri;
    }
375273
public function setNamespace($namespace)
    {
        $namespace = rtrim(trim($namespace), '\\');

        if ($namespace === $this->namespace) {
            return;
        }

        $this->namespace = $namespace;
        if ($namespace && (!$this->package || $this->packageOverridden) && $this->getBuildProperty('generator.namespaceAutoPackage')) {
            $this->package = str_replace('\\', '.', $namespace);
            $this->packageOverridden = true;
        }
    }
751761
public function addPath(string $path, string $namespace = null) : void
    {
        if (! $namespace) {
            $this->template->addLocation($path);
            return;
        }

        $this->template->addNamespace($namespace, $path);
    }
29505
public static function getComponentNamespace(string $component, string $path):string
    {
        $composerFile = $path . DS . 'composer.json';
        $namespaceMapping = self::parseAutoloadFromComposerFile($composerFile);
        $ns = $namespaceMapping['src/'] ?? self::getDefaultNamespace($component);
        return $ns;
    }