returns a reference to the dirscanner object belonging to this fileset

@param  Project $p
@throws BuildException
@return \DirectoryScanner
513701
public function getDirectoryScanner(Project $p = null)
    {
        if ($p === null) {
            $p = $this->getProject();
        }

        if ($this->isReference()) {
            $o = $this->getRef($p);

            return $o->getDirectoryScanner($p);
        }

        if ($this->dir === null) {
            throw new BuildException(sprintf("No directory specified for <%s>.", strtolower(get_class($this))));
        }
        if (!$this->dir->exists() && $this->errorOnMissingDir) {
            throw new BuildException("Directory " . $this->dir->getAbsolutePath() . " not found.");
        }
        if (!$this->dir->isLink() || !$this->expandSymbolicLinks) {
            if (!$this->dir->isDirectory()) {
                throw new BuildException($this->dir->getAbsolutePath() . " is not a directory.");
            }
        }
        $ds = new DirectoryScanner();
        $ds->setExpandSymbolicLinks($this->expandSymbolicLinks);
        $ds->setErrorOnMissingDir($this->errorOnMissingDir);
        $this->setupDirectoryScanner($ds, $p);
        $ds->scan();

        return $ds;
    }
710179
protected function _scandir($path) {
		$files = array();
		
		foreach (scandir($path) as $name) {
			if ($name != '.' && $name != '..') {
				$files[] = $path.DIRECTORY_SEPARATOR.$name;
			}
		}
		return $files;
	}
1040545
public function createMapper()
    {
        if ($this->mapperElement !== null) {
            throw new BuildException(
                'Cannot define more than one mapper',
                $this->getLocation()
            );
        }
        $this->mapperElement = new Mapper($this->project);

        return $this->mapperElement;
    }
35087
public static function build($p)
    {
        if (is_object($p)) {
            if ($p instanceof PosMap) {
                return $p;
            }
            $generated = isset($p->generated) ? $p->generated : null;
            $source = isset($p->source) ? $p->source : null;
        } elseif (is_array($p)) {
            $generated = isset($p['generated']) ? $p['generated'] : null;
            $source = isset($p['source']) ? $p['source'] : null;
        } else {
            $generated = null;
            $source = null;
        }
        return new PosMap($generated, $source);
    }
1366709
private function readFiles(Project $p)
    {
        if (!empty($this->includesFileList)) {
            foreach ($this->includesFileList as $ne) {
                $fileName = (string) $ne->evalName($p);
                if ($fileName !== null) {
                    $inclFile = $p->resolveFile($fileName);
                    if (!$inclFile->exists()) {
                        throw new BuildException("Includesfile " . $inclFile->getAbsolutePath() . " not found.");
                    }
                    $this->readPatterns($inclFile, $this->includeList, $p);
                }
            }
            $this->includesFileList = [];
        }

        if (!empty($this->excludesFileList)) {
            foreach ($this->excludesFileList as $ne) {
                $fileName = (string) $ne->evalName($p);
                if ($fileName !== null) {
                    $exclFile = $p->resolveFile($fileName);
                    if (!$exclFile->exists()) {
                        throw new BuildException("Excludesfile " . $exclFile->getAbsolutePath() . " not found.");
                    }
                    $this->readPatterns($exclFile, $this->excludeList, $p);
                }
            }
            $this->excludesFileList = [];
        }
    }
606844
public function getDir(Project $p = null)
    {
        if ($p === null) {
            $p = $this->getProject();
        }
        if ($this->pps === null) {
            $this->loadPearPackageScanner($p);
        }

        return new PhingFile((string) $this->pps->getBaseDir());
    }
739954
protected function getProjectDir()
    {
        $dir = rtrim($this->getInputDir(), '/');
        if (is_dir($dir . '/.phrozn')) {
            $dir .= '/.phrozn/';
        }

        // see if we have entries folder present
        if (!is_dir($dir . '/entries')) {
            throw new \RuntimeException('Entries folder not found');
        }

        return $dir;
    }
584355
private function _scan(&$fromDir, &$toDir, &$files, &$dirs)
    {
        /* mappers should be generic, so we get the mappers here and
        pass them on to builMap. This method is not redundan like it seems */
        $mapper = $this->getMapper();

        $this->buildMap($fromDir, $toDir, $files, $mapper, $this->fileCopyMap);

        if ($this->includeEmpty) {
            $this->buildMap($fromDir, $toDir, $dirs, $mapper, $this->dirCopyMap);
        }
    }
784459
public function scan($project)
    {
        //@TODO: allow scan of individual files
        // First check if target is a directory
        if (!is_dir($project)) {
            $this->getConsole()->writeLine($project . ' is not a directory!');
            return $this;
        }

        $iteratorIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($project));

        //@TODO: make ignored paths a param
        // Exclude the paths containing vendor and non-php files
        $regexIterator = new \RegexIterator($iteratorIterator, '/^(?!.*vendor.*).*\.php$/i', \RecursiveRegexIterator::GET_MATCH);

        foreach ($regexIterator as $fileMatches) {
            foreach ($fileMatches as $fileMatch) {

                $fileContent = file_get_contents($fileMatch);

                preg_match_all('/Zend\\\\[a-zA-Z0-9]*/', (string) $fileContent, $matches, PREG_PATTERN_ORDER);

                foreach ($matches as $submatches) {
                    foreach ($submatches as $match) {
                        $zendComponent = strtolower(str_replace('\\', '-', $match));
                        $componentParts = explode('-', $zendComponent);

                        if ($componentParts[0] !== '' && $componentParts[1] !== '') {
                            $this->components[$zendComponent] = true;
                        }
                    }
                }
            }
        }

        ksort($this->components);

        return $this;
    }
1214663
public function digipolisMirrorDir($dir, $destination)
    {
        if (!is_dir($dir)) {
            return;
        }
        $task = $this->taskFilesystemStack();
        $task->mkdir($destination);

        $directoryIterator = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
        $recursiveIterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($recursiveIterator as $item) {
            $destinationFile = $destination . DIRECTORY_SEPARATOR . $recursiveIterator->getSubPathName();
            if (file_exists($destinationFile)) {
                continue;
            }
            if (is_link($item)) {
                if ($item->getRealPath() !== false) {
                    $task->symlink($item->getLinkTarget(), $destinationFile);
                }
                continue;
            }
            if ($item->isDir()) {
                $task->mkdir($destinationFile);
                continue;
            }
            $task->copy($item, $destinationFile);
        }
        return $task;
    }
201349
@Override
   public DirectoryResourceImpl getChildDirectory(final String name) throws ResourceException
   {
      Resource<?> result = getChild(name);
      if (!(result instanceof DirectoryResourceImpl))
      {
         if (result.exists())
         {
            throw new ResourceException("The resource [" + result.getFullyQualifiedName()
                     + "] is not a DirectoryResource");
         }
      }

      if (!(result instanceof DirectoryResourceImpl))
      {
         result = new DirectoryResourceImpl(getResourceFactory(), new File(getUnderlyingResourceObject()
                  .getAbsoluteFile(), name));
      }
      return (DirectoryResourceImpl) result;
   }
140311
private void scanClassesDirectory(MavenProjectDirectoryDescriptor projectDescriptor, MavenArtifactDescriptor artifactDescriptor, final String directoryName,
            Scanner scanner) {
        File directory = new File(directoryName);
        if (directory.exists()) {
            scanArtifact(projectDescriptor, artifactDescriptor, directory, directoryName, scanner);
        }
    }
1053710
public function process(ProjectDescriptor $project)
    {
        foreach ($this->behaviours as $behaviour) {
            $project = $behaviour->process($project);
        }

        return $project;
    }
1151592
private static function getMainReadme(string $projectRootDirectory): string
    {
        $path = $projectRootDirectory . '/README.md';
        if (!is_file($path)) {
            throw new \RuntimeException(
                "\n\nYou have no README.md file in your project"
                . "\n\nAs the bear minimum you need to have this file to pass QA"
            );
        }

        return $path;
    }
836831
public function append($other, $p)
    {
        if ($this->isReference()) {
            throw new BuildException("Cannot append to a reference");
        }

        $incl = $other->getIncludePatterns($p);
        if ($incl !== null) {
            foreach ($incl as $incl_name) {
                $o = $this->createInclude();
                $o->setName($incl_name);
            }
        }

        $excl = $other->getExcludePatterns($p);
        if ($excl !== null) {
            foreach ($excl as $excl_name) {
                $o = $this->createExclude();
                $o->setName($excl_name);
            }
        }
    }
547885
protected static function listProjectFiles( $path )
	{
		$list	= array();
		$dir	= new DirectoryIterator( $path );
		foreach( $dir as $entry )
		{
			if( $entry->isDot() )
				continue;
			if( !preg_match( "@\.gan$@", $entry->getFilename() ) )
				continue;
			$list[]	= $entry->getPathname();
		}
		return $list;
	}
382247
public function setProjectDirectory(string $dir): Application
    {
        if (is_dir($dir)) {
            $this->projectDir = $dir;
        }

        return $this;
    }