public function addDirectory($path)
    {
        $finder = new \Symfony\Component\Finder\Finder();

        $patterns = $this->getIgnorePatterns()->getRegularExpression();

        if ($this->follow_symlinks) {
            $finder->followLinks();
        }

        // restrict names to those ending in the given extensions
        $finder
            ->files()
            ->in($path)
            ->name(
                '/\.('.implode('|', $this->allowed_extensions->getArrayCopy()).')$/'
            )
            ->ignoreDotFiles($this->getIgnoreHidden())
            ->filter(
                function(\SplFileInfo $file) use ($patterns) {
                    if (!$patterns) {
                        return true;
                    }

                    // apply ignore list on path instead of file, finder
                    // can't do that by default
                    return !preg_match($patterns, $file->getPathname());
                }
            );

        try {
            /** @var \SplFileInfo $file */
            foreach ($finder as $file) {
                $file = new File($file);
                $path = $file->getRealPath()
                    ? $file->getRealPath()
                    : $file->getPathname();

                $this[$path] = $file;
            }
        } catch(\LogicException $e)
        {
            // if a logic exception is thrown then no folders were included
            // for phpDocumentor this is not an issue since we accept separate
            // files as well
        }
    }
public function addDirectory($path)
    {
        $finder = new \Symfony\Component\Finder\Finder();

        $patterns = $this->getIgnorePatterns()->getRegularExpression();

        if ($this->follow_symlinks) {
            $finder->followLinks();
        }

        // restrict names to those ending in the given extensions
        $finder
            ->files()
            ->in($path)
            ->name(
                '/\.('.implode('|', $this->allowed_extensions->getArrayCopy()).')$/'
            )
            ->ignoreDotFiles($this->getIgnoreHidden())
            ->filter(
                function(\SplFileInfo $file) use ($patterns) {
                    if (!$patterns) {
                        return true;
                    }

                    // apply ignore list on path instead of file, finder
                    // can't do that by default
                    return !preg_match($patterns, $file->getPathname());
                }
            );

        try {
            /** @var \SplFileInfo $file */
            foreach ($finder as $file) {
                $file = new File($file);
                $path = $file->getRealPath()
                    ? $file->getRealPath()
                    : $file->getPathname();

                $this[$path] = $file;
            }
        } catch(\LogicException $e)
        {
            // if a logic exception is thrown then no folders were included
            // for phpDocumentor this is not an issue since we accept separate
            // files as well
        }
    }
public function addDirectory ( $ path ) { $ finder = new \ Symfony \ Component \ Finder \ Finder ( ) ; $ patterns = $ this -> getIgnorePatterns ( ) -> getRegularExpression ( ) ; if ( $ this -> follow_symlinks ) { $ finder -> followLinks ( ) ; } // restrict names to those ending in the given extensions $ finder -> files ( ) -> in ( $ path ) -> name ( '/\.(' . implode ( '|' , $ this -> allowed_extensions -> getArrayCopy ( ) ) . ')$/' ) -> ignoreDotFiles ( $ this -> getIgnoreHidden ( ) ) -> filter ( function ( \ SplFileInfo $ file ) use ( $ patterns ) { if ( ! $ patterns ) { return true ; } // apply ignore list on path instead of file, finder // can't do that by default return ! preg_match ( $ patterns , $ file -> getPathname ( ) ) ; } ) ; try { /** @var \SplFileInfo $file */ foreach ( $ finder as $ file ) { $ file = new File ( $ file ) ; $ path = $ file -> getRealPath ( ) ? $ file -> getRealPath ( ) : $ file -> getPathname ( ) ; $ this [ $ path ] = $ file ; } } catch ( \ LogicException $ e ) { // if a logic exception is thrown then no folders were included // for phpDocumentor this is not an issue since we accept separate // files as well } }
Retrieve all files in the given directory and add them to the parsing list.

@param string $path A path to a folder, may be relative, absolute or
even phar.

@return void
Retrieve all files in the given directory and add them to the parsing list .