Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of #735 - part 3 #939

Merged
merged 2 commits into from
Jun 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions classes/phing/util/DirectoryScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,15 +715,37 @@ protected function isExcluded($_name)
return false;
}

/**
* Return the count of included files.
*
* @return int
*
* @throws UnexpectedValueException
*/
public function getIncludedFilesCount(): int
{
if ($this->filesIncluded === null) {
throw new UnexpectedValueException('Must call scan() first');
}
return count($this->filesIncluded);
}

/**
* Get the names of the files that matched at least one of the include
* patterns, and matched none of the exclude patterns.
* The names are relative to the basedir.
*
* @return array names of the files
* @throws \UnexpectedValueException
*/
public function getIncludedFiles()
public function getIncludedFiles(): array
{
if ($this->filesIncluded === null) {
throw new UnexpectedValueException('Must call scan() first');
}

sort($this->filesIncluded);

return $this->filesIncluded;
}

Expand Down Expand Up @@ -779,13 +801,35 @@ public function getDeselectedFiles()
* The names are relative to the basedir.
*
* @return array the names of the directories
* @throws \UnexpectedValueException
*/

public function getIncludedDirectories()
{
if ($this->dirsIncluded === null) {
throw new UnexpectedValueException('Must call scan() first');
}

sort($this->dirsIncluded);

return $this->dirsIncluded;
}

/**
* Return the count of included directories.
*
* @return int
*
* @throws UnexpectedValueException
*/
public function getIncludedDirectoriesCount(): int
{
if ($this->dirsIncluded === null) {
throw new UnexpectedValueException('Must call scan() first');
}
return count($this->dirsIncluded);
}

/**
* Get the names of the directories that matched at none of the include
* patterns.
Expand Down Expand Up @@ -870,10 +914,13 @@ public function isEverythingIncluded()
/**
* Tests whether a name should be selected.
*
* @param string $name The filename to check for selecting.
* @param string $file The full file path.
* @param string $name The filename to check for selecting.
* @param string $file The full file path.
* @return boolean False when the selectors says that the file
* should not be selected, True otherwise.
* @throws \BuildException
* @throws \IOException
* @throws NullPointerException
*/
protected function isSelected($name, $file)
{
Expand Down