Add all entity classes in a directory.

@param string $namespace The base namespace of the entities
@param string $directory The directory
199379
public function addEntityDirectory($namespace, $directory)
    {
        if (!is_dir($directory)) {
            return;
        }
        $files = new \DirectoryIterator($directory);

        foreach ($files as $file) {
            if ($file->isDir() && !$file->isDot()) {
                $this->addEntityDirectory($namespace.'\\'.basename($file->getPathname()) , $file->getPathname());
                continue;
            }

            if (!$file->isFile()) {
                continue;
            }

            $class = $namespace.'\\'.$file->getBasename('.php');
            $r = new \ReflectionClass($class);
            if ($r->isSubclassOf('ActiveDoctrine\Entity\Entity') && !$r->isAbstract()) {
                $this->addEntityClass($class);
            }
        }
    }
1094886
public function addFolder(string $directory, string $alias = '')
	{
		if ($alias === '')
		{
			throw new \InvalidArgumentException('Setting an alias is required in Plates');
		}

		$this->getRenderer()->addFolder($alias, $directory);

		return $this;
	}
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;
    }
366750
public static function addPath ($path, $namespace = \Twig_Loader_Filesystem::MAIN_NAMESPACE)
    {
        $twigLoader = self::getTwigLoader();
        /* @var $twigLoader \Twig_Loader_Filesystem */
        $twigLoader->addPath($path, $namespace);
    }
1023148
public function attachNamespace($namespace, $paths)
    {
        if (isset($this->namespaces[$namespace])) {
            if (is_array($paths)) {
                $this->namespaces[$namespace] = array_merge($this->namespaces[$namespace], $paths);
            } else {
                $this->namespaces[$namespace][] = $paths;
            }
        } else {
            $this->namespaces[$namespace] = (array) $paths;
        }

        return $this;
    }
843403
protected function findClassMappingInDirectory($OClass, $directory, $namespace)
    {
        $finder = new Finder();

        if (isset($this->classMap[$OClass])) {
            return $this->classMap[$OClass];
        }

        foreach ($finder->files()->name('*.php')->in($directory) as $file) {
            $class = $this->getClassByPath($file, $namespace);

            if (class_exists($class)) {
                $annotation = $this->getClassAnnotation($class);

                if ($annotation && $annotation->hasMatchingClass($OClass)) {
                    $this->classMap[$OClass] = $class;
                    return $class;
                }
            }
        }

        return null;
    }
1290902
public function addDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = $this->errorCache = [];

        if (!$dir->exists()) {
            throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
        }
        if (!$dir->isDir()) {
            throw new LoaderError(sprintf('The path "%s" is not a directory.', $dir->getFullPath()));
        }

        $this->paths[$namespace][] = $dir;
    }
1253935
public function addDirectory($directory)
    {
        if (isset($this->directories[$directory])) {
            return;
        }
        // index by name to avoid duplicates
        $this->directories[$directory] = $directory;

        // clear currently loaded translations to force reloading them
        $this->translations = array();
    }
751761
public function addPath(string $path, string $namespace = null) : void
    {
        if (! $namespace) {
            $this->template->addLocation($path);
            return;
        }

        $this->template->addNamespace($namespace, $path);
    }
193258
private function loadPackageTemplate($directory)
    {
        $namespacedPackageClass = $this->packageLoader->loadPackage(realpath($directory));
        $this->autoLoaderManager->mergePackageLoader(realpath($directory));
        $this->package = app($namespacedPackageClass);
    }
536676
public function addTo($namespace, $key, $value = null)
    {
        $oldNamespace = $this->namespace;
        $this->setNamespace($namespace);
        $this->add($key, $value);
        $this->setNamespace($oldNamespace);
    }
367864
public function add_template_directory($directory, $namespace = null) {
		if ($this->filesystem_loader === null) {
			$this->filesystem_loader = new \Twig_Loader_Filesystem($directory);
		}

		if ($namespace === null) {
			$this->filesystem_loader->addPath($directory);
		} else {
			$this->filesystem_loader->addPath($directory, $namespace);
		}
	}
253123
private function apply_namespace_filters( $namespace, $class, $dir )
    {
        foreach( $this->filters[$namespace] as $filter )
        {
            if( is_callable( $filter ) )
            {
                $file = call_user_func_array( $filter, array( $class, $namespace, $dir ) );
                if ( file_exists( $file ) ) 
                {
                    return $file;
                }
            }
        }
    }
383593
public function AddTypeDef(
        \Peg\Lib\Definitions\Element\TypeDef $typedef, 
        $namespace = "\\"
    )
    {
        $this->CreateNamespace($namespace);
        
        $typedef->header =& $this;
        $typedef->namespace =& $this->namespaces[$namespace];

        $this->namespaces[$namespace]
            ->type_definitions[$typedef->name] = $typedef
        ;
    }
317097
public static function shadow_package( $dir, $namespace, $shadows ) 
	{
		foreach( $shadows as $name => $path ) 
		{
			static::$shadows[$name] = $class = $namespace."\\".$name;
			static::$classes[$class] = $dir.$path;
		}
	}
656132
private function readDirectoryContent(string $directory): void
    {
        $items = new DirectoryIterator($directory);

        foreach ($items as $item) {

            if ($item->isFile() && $this->isFile($item->getFilename())) {
                $this->readFileContent($item->getPathname());
            }
        }
    }
1073325
public function addNamespaces(array $namespaces)
    {
        foreach ($namespaces as $prefix => $baseDir) {
            $this->addNamespace($prefix, $baseDir);
        }
    }