Skip to content

Commit 181e2ab

Browse files
committed
Filters/ExactMatch: rename some private properties
Remove the needless use of culturally insensitive blacklist/whitelist terminology used in the property names and the documentation. As these properties are `private`, this is a change which doesn't affect the API and is therefore non-breaking.
1 parent 33429dd commit 181e2ab

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/Filters/ExactMatch.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* An abstract filter class for checking files and folders against exact matches.
44
*
5-
* Supports both whitelists and blacklists.
5+
* Supports both allowed files and blocked files.
66
*
77
* @author Greg Sherwood <[email protected]>
88
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -21,22 +21,22 @@ abstract class ExactMatch extends Filter
2121
*
2222
* @var array
2323
*/
24-
private $blacklist = null;
24+
private $blockedFiles = null;
2525

2626
/**
2727
* A list of files to include.
2828
*
29-
* If the whitelist is empty, only files in the blacklist will be excluded.
29+
* If the allowed files list is empty, only files in the blocked files list will be excluded.
3030
*
3131
* @var array
3232
*/
33-
private $whitelist = null;
33+
private $allowedFiles = null;
3434

3535

3636
/**
3737
* Check whether the current element of the iterator is acceptable.
3838
*
39-
* If a file is both blacklisted and whitelisted, it will be deemed unacceptable.
39+
* If a file is both blocked and allowed, it will be deemed unacceptable.
4040
*
4141
* @return bool
4242
*/
@@ -46,59 +46,59 @@ public function accept()
4646
return false;
4747
}
4848

49-
if ($this->blacklist === null) {
50-
$this->blacklist = $this->getblacklist();
49+
if ($this->blockedFiles === null) {
50+
$this->blockedFiles = $this->getblacklist();
5151
}
5252

53-
if ($this->whitelist === null) {
54-
$this->whitelist = $this->getwhitelist();
53+
if ($this->allowedFiles === null) {
54+
$this->allowedFiles = $this->getwhitelist();
5555
}
5656

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

59-
// If file is both blacklisted and whitelisted, the blacklist takes precedence.
60-
if (isset($this->blacklist[$filePath]) === true) {
59+
// If file is both blocked and allowed, the blocked files list takes precedence.
60+
if (isset($this->blockedFiles[$filePath]) === true) {
6161
return false;
6262
}
6363

64-
if (empty($this->whitelist) === true && empty($this->blacklist) === false) {
65-
// We are only checking a blacklist, so everything else should be whitelisted.
64+
if (empty($this->allowedFiles) === true && empty($this->blockedFiles) === false) {
65+
// We are only checking a blocked files list, so everything else should be allowed.
6666
return true;
6767
}
6868

69-
return isset($this->whitelist[$filePath]);
69+
return isset($this->allowedFiles[$filePath]);
7070

7171
}//end accept()
7272

7373

7474
/**
7575
* Returns an iterator for the current entry.
7676
*
77-
* Ensures that the blacklist and whitelist are preserved so they don't have
77+
* Ensures that the blocked files list and the allowed files list are preserved so they don't have
7878
* to be generated each time.
7979
*
8080
* @return \RecursiveIterator
8181
*/
8282
public function getChildren()
8383
{
84-
$children = parent::getChildren();
85-
$children->blacklist = $this->blacklist;
86-
$children->whitelist = $this->whitelist;
84+
$children = parent::getChildren();
85+
$children->blockedFiles = $this->blockedFiles;
86+
$children->allowedFiles = $this->allowedFiles;
8787
return $children;
8888

8989
}//end getChildren()
9090

9191

9292
/**
93-
* Get a list of blacklisted file paths.
93+
* Get a list of file paths to exclude.
9494
*
9595
* @return array
9696
*/
9797
abstract protected function getBlacklist();
9898

9999

100100
/**
101-
* Get a list of whitelisted file paths.
101+
* Get a list of file paths to include.
102102
*
103103
* @return array
104104
*/

src/Filters/GitModified.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GitModified extends ExactMatch
1616

1717

1818
/**
19-
* Get a list of blacklisted file paths.
19+
* Get a list of file paths to exclude.
2020
*
2121
* @return array
2222
*/
@@ -28,7 +28,7 @@ protected function getBlacklist()
2828

2929

3030
/**
31-
* Get a list of whitelisted file paths.
31+
* Get a list of file paths to include.
3232
*
3333
* @return array
3434
*/

src/Filters/GitStaged.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GitStaged extends ExactMatch
1818

1919

2020
/**
21-
* Get a list of blacklisted file paths.
21+
* Get a list of file paths to exclude.
2222
*
2323
* @return array
2424
*/
@@ -30,7 +30,7 @@ protected function getBlacklist()
3030

3131

3232
/**
33-
* Get a list of whitelisted file paths.
33+
* Get a list of file paths to include.
3434
*
3535
* @return array
3636
*/

0 commit comments

Comments
 (0)