Returns the file specifications this directory specification applies to.
The entire source directory tree is considered, except for excluded files.
@return FileSpecification[]
968614
public function getFileSpecifications() {
        $fileSpecifications = array();
        
        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getSource())) as $entry)
            if (!fphp\Helper\Path::isDot($entry)) {
                $fileSource = $entry->getPathName();
                if (is_link($fileSource))
                    continue;
                $relativeFileTarget = fphp\Helper\Path::stripBase(
                    realpath($fileSource), realpath($this->getSource()));

                foreach ($this->getExclude() as $exclude) {
                    if ($relativeFileTarget === $exclude)
                        continue 2;
                    $parts = explode("/", $exclude);
                    if ($parts[count($parts) - 1] === "*")
                        try {
                            fphp\Helper\Path::stripBase($relativeFileTarget, implode("/", array_slice($parts, 0, count($parts) - 1)));
                            continue 2;
                        } catch (fphp\Helper\PathException $e) {}
                }
                        
                $fileTarget = fphp\Helper\Path::join(
                    $this->get("baseTarget"), fphp\Helper\Path::join($this->getTarget(), $relativeFileTarget));
                $fileSpecifications[] = new FileSpecification(
                    array("source" => $fileSource, "target" => $fileTarget), $this->getDirectory());
            }
        
        return $fileSpecifications;
    }
488992
public function getIncludedFiles()
	{
		// We'll cache this internally to avoid running this
		// multiple times.
		if(empty($this->includedFiles))
		{
			$files = get_included_files();

			foreach($files as $filePath)
			{
				$size = $this->readableSize(filesize($filePath));

				$this->includedFiles[] = compact('filePath', 'size');
			}
		}

		return $this->includedFiles;
	}
927019
protected function getFileSystem(): array
	{
		$fileSystem = [];

		$command = $this->readCommand('df -T');
		if ($command) {
			$bufe = preg_split("/\n/", $command, -1, PREG_SPLIT_NO_EMPTY);
			unset($bufe[0]);
			foreach ($bufe as $buf) {
				$data = preg_split('/\s+/', $buf);
				$mounted = new Obj;

				$mounted->partition = $data[0];
				$mounted->type = $data[1];
				$mounted->size = $data[2] * 1024;
				$mounted->used = $data[3] * 1024;
				$mounted->free = $data[4] * 1024;
				$mounted->usage = $data[5];
				$mounted->mountPoint = $data[6];

				$fileSystem[] = $mounted;
			}
		}

		return $fileSystem;
	}
145620
protected function getIncomingFiles()
    {
        $fh = $this->app->make('helper/validation/file');
        $nh = $this->app->make('helper/number');
        $incoming = $this->app->make(Incoming::class);
        $files = $incoming->getIncomingFilesystem()->listContents($incoming->getIncomingPath());
        foreach (array_keys($files) as $index) {
            $files[$index]['allowed'] = $fh->extension($files[$index]['basename']);
            $files[$index]['thumbnail'] = FileTypeList::getType($files[$index]['extension'])->getThumbnail();
            $files[$index]['displaySize'] = $nh->formatSize($files[$index]['size'], 'KB');
        }

        return $files;
    }
459060
private function getConfiguration()
    {
        return array_merge(
            [
                'fileMimeTypeField' => false,
                'fileNameField'     => false,
                'filePathField'     => false,
                'fileSizeField'     => false,
            ],
            $this->classMetadata->getExtension(UploadableDriver::EXTENSION_NAME),
            [
                'uploadable'        => true,
                'allowOverwrite'    => $this->allowOverwrite,
                'appendNumber'      => $this->appendNumber,
                'path'              => $this->path,
                'pathMethod'        => $this->pathMethod,
                'callback'          => $this->callback,
                'filenameGenerator' => $this->filenameGenerator,
                'maxSize'           => (float) $this->maxSize,
                'allowedTypes'      => $this->allowedTypes,
                'disallowedTypes'   => $this->disallowedTypes,
            ]
        );
    }
329495
public function provideFilesToCheck()
    {
        $iterator = new AppendIterator();

        foreach ($this->getPaths() as $path) {
            $iterator->append(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
        }

        $files = new CallbackFilterIterator($iterator, function ($file) {
            return $file->getFilename()[0] !== '.' && !$file->isDir();
        });

        return array_map(function ($file) {
            return [(string) $file];
        }, iterator_to_array($files));
    }
1353331
public function getStagedFiles()
    {
        $base = $this->getProjectBase();

        $files = new FileCollection();

        foreach ($this->getFiles() as $file) {
            $fileData = explode("\t", $file);
            $status = reset($fileData);
            $relativePath = end($fileData);

            $fullPath = rtrim($base . DIRECTORY_SEPARATOR . $relativePath);

            $file = new File($status, $fullPath, $base);
            $this->saveFileToCache($file);
            $files->append($file);
        }

        return $files;
    }
843764
private function getExcludePaths(): array
    {
        $excludePaths = [];

        foreach ($this->excludePaths as $path) {
            $path = str_replace('*', '.*', $path);
            $excludePaths[] = '#' . str_replace($this->rootDirectory . '/', '', $path) . '#';
        }

        return $excludePaths;
    }
34988
public function getFilenames()
    {
        $filenames = [];
        foreach ($this->filenames as $f) {
            foreach ($this->inclusiveFilters as $filter) {
                if (!preg_match($filter, $f)) {
                    continue 2;
                }
            }
            foreach ($this->exclusiveFilters as $filter) {
                if (preg_match($filter, $f)) {
                    continue 2;
                }
            }
            $filenames[] = $f;
        }

        return $filenames;
    }
347706
public function getFileSets()
    {
        $filesets = [];
        foreach ($this->getFileSetIDs() as $fsID) {
            $fs = FileSet::getByID($fsID);
            if ($fs !== null) {
                $filesets[] = $fs;
            }
        }

        return $filesets;
    }
240393
public function getExtensionsByType()
  {
    $ext = array();

    foreach ($this->Config->get('file-extensions') as $key => $value)
    {
      $ext[$key] = $value['extensions'];
    }

    return $ext;
  }
801967
protected function _getIncludedFiles()
    {
        if (null !== $this->_includedFiles) {
            return $this->_includedFiles;
        }

        $this->_includedFiles = get_included_files();
        sort($this->_includedFiles);
        return $this->_includedFiles;
    }
141675
public function collectExpectedExportIgnores()
    {
        $expectedExportIgnores = [];

        $initialWorkingDirectory = (string) getcwd();

        chdir($this->directory);

        $ignoredGlobMatches = array_merge(
            $this->ignoredGlobMatches,
            $this->getGitignoredPatterns()
        );

        foreach (glob($this->globPattern, GLOB_BRACE) as $filename) {
            if (!in_array($filename, $ignoredGlobMatches)) {
                if (is_dir($filename)) {
                    $expectedExportIgnores[] = $filename . '/';
                    continue;
                }
                $expectedExportIgnores[] = $filename;
            }
        }

        chdir($initialWorkingDirectory);

        if ($this->hasGitattributesFile()) {
            $expectedExportIgnores = array_merge(
                $expectedExportIgnores,
                $this->getPresentExportIgnoresToPreserve($expectedExportIgnores)
            );
        }

        sort($expectedExportIgnores, SORT_STRING | SORT_FLAG_CASE);

        if ($this->isKeepLicenseEnabled()) {
            $licenseLessExpectedExportIgnores = [];
            array_filter($expectedExportIgnores, function ($exportIgnore) use (
                &$licenseLessExpectedExportIgnores
            ) {
                if (!preg_match('/(License.*)/i', $exportIgnore)) {
                    $licenseLessExpectedExportIgnores[] = $exportIgnore;
                }
            });

            $expectedExportIgnores = $licenseLessExpectedExportIgnores;
        }

        return array_unique($expectedExportIgnores);
    }
768691
private function getDescriptors(): array
    {
        if ($this->input instanceof \Iterator) {
            $this->input->rewind();
        }
        if ('\\' === \DIRECTORY_SEPARATOR) {
            $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
        } else {
            $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
        }

        return $this->processPipes->getDescriptors();
    }
675306
protected function detectDirectoryDescendants()
    {
        $descendants = [];

        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->getPath())) as $file) {
            if ($file->isDir() && ! in_array($file->getBasename(), array('.', '..'))) {
                $resource = new DirectoryResource($file, $this->files);

                $descendants[$resource->getKey()] = $resource;
            } elseif ($file->isFile()) {
                $resource = new FileResource($file, $this->files);

                $descendants[$resource->getKey()] = $resource;
            }
        }

        return $descendants;
    }
923378
private function getIncludedFiles()
    {
        // Retrieve the include and exclude lists
        // from the options
        $include = Options::get('coverage.include');
        $exclude = Options::get('coverage.exclude');

        // Create empty arrays to store our filenames in
        $includedFiles = [];
        $excludedFiles = [];

        // If we have marked files as included
        if ($include !== null) {
            // Convert a string to an array so that
            // we only have to loop once
            if (!is_array($include)) {
                $include = [$include];
            }

            // Loop through each of the include glob strings
            foreach ($include as $glob) {
                // Prepend the current working directory to the glob
                $glob = $this->runner->pwd.'/'.$glob;

                // Add the glob results to the included files array
                $includedFiles = array_merge($includedFiles, glob_recursive($glob));
            }
        }

        // If we have marked files as excluded
        if ($exclude !== null) {
            // Convert a string to an array so that
            // we only have to loop once
            if (!is_array($exclude)) {
                $exclude = [$exclude];
            }

            // Loop through each of the include glob strings
            foreach ($exclude as $glob) {
                // Prepend the current working directory to the glob
                $glob = $this->runner->pwd.'/'.$glob;

                // Add the glob results to the excluded files array
                $excludedFiles = array_merge($excludedFiles, glob_recursive($glob));
            }
        }

        // Store the results
        $this->includedFiles = $includedFiles ?: [];
        $this->excludedFiles = $excludedFiles ?: [];
    }
1331818
public function get_children() {
        if (!$this->lf->is_directory()) {
            return array();
        }

        $result = array();
        $fs = get_file_storage();

        $storedfiles = $fs->get_directory_files($this->context->id, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(),
                                                $this->lf->get_filepath(), false, true, "filepath, filename");
        foreach ($storedfiles as $file) {
            $result[] = new file_info_stored($this->browser, $this->context, $file, $this->urlbase, $this->topvisiblename,
                                             $this->itemidused, $this->readaccess, $this->writeaccess, false);
        }

        return $result;
    }