Skip to content

Filter/ExactMatch: rename a private property #258

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

Merged
merged 1 commit into from
Jan 12, 2024
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
26 changes: 13 additions & 13 deletions src/Filters/ExactMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* An abstract filter class for checking files and folders against exact matches.
*
* Supports both allowed files and blocked files.
* Supports both allowed files and disallowed files.
*
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
Expand All @@ -21,12 +21,12 @@ abstract class ExactMatch extends Filter
*
* @var array
*/
private $blockedFiles = null;
private $disallowedFiles = null;

/**
* A list of files to include.
*
* If the allowed files list is empty, only files in the blocked files list will be excluded.
* If the allowed files list is empty, only files in the disallowed files list will be excluded.
*
* @var array
*/
Expand All @@ -36,7 +36,7 @@ abstract class ExactMatch extends Filter
/**
* Check whether the current element of the iterator is acceptable.
*
* If a file is both blocked and allowed, it will be deemed unacceptable.
* If a file is both disallowed and allowed, it will be deemed unacceptable.
*
* @return bool
*/
Expand All @@ -46,8 +46,8 @@ public function accept()
return false;
}

if ($this->blockedFiles === null) {
$this->blockedFiles = $this->getblacklist();
if ($this->disallowedFiles === null) {
$this->disallowedFiles = $this->getblacklist();
}

if ($this->allowedFiles === null) {
Expand All @@ -56,13 +56,13 @@ public function accept()

$filePath = Util\Common::realpath($this->current());

// If file is both blocked and allowed, the blocked files list takes precedence.
if (isset($this->blockedFiles[$filePath]) === true) {
// If file is both disallowed and allowed, the disallowed files list takes precedence.
if (isset($this->disallowedFiles[$filePath]) === true) {
return false;
}

if (empty($this->allowedFiles) === true && empty($this->blockedFiles) === false) {
// We are only checking a blocked files list, so everything else should be allowed.
if (empty($this->allowedFiles) === true && empty($this->disallowedFiles) === false) {
// We are only checking a disallowed files list, so everything else should be allowed.
return true;
}

Expand All @@ -74,16 +74,16 @@ public function accept()
/**
* Returns an iterator for the current entry.
*
* Ensures that the blocked files list and the allowed files list are preserved so they don't have
* Ensures that the disallowed files list and the allowed files list are preserved so they don't have
* to be generated each time.
*
* @return \RecursiveIterator
*/
public function getChildren()
{
$children = parent::getChildren();
$children->blockedFiles = $this->blockedFiles;
$children->allowedFiles = $this->allowedFiles;
$children->disallowedFiles = $this->disallowedFiles;
$children->allowedFiles = $this->allowedFiles;
return $children;

}//end getChildren()
Expand Down