File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,14 @@ class Filter
2222 */
2323 private $ whitelistedFiles = [];
2424
25+ private $ ignoreLists = [];
26+
27+ /**
28+ * @param array $ignoreLists
29+ */
30+ public function setIgnoreLists ($ ignoreLists ) {
31+ $ this ->ignoreLists = $ ignoreLists ;
32+ }
2533 /**
2634 * Adds a directory to the whitelist (recursively).
2735 *
@@ -127,8 +135,17 @@ public function isFiltered($filename)
127135 }
128136
129137 $ filename = realpath ($ filename );
130-
138+ if (empty ($ this ->whitelistedFiles )){
139+ foreach ($ this ->ignoreLists as $ ignorePattern ){
140+ $ pattern = '/ ' .$ ignorePattern .'/ ' ;
141+ if (preg_match ($ pattern , $ filename )){
142+ return true ;
143+ }
144+ }
145+ return false ;
146+ } else {
131147 return !isset ($ this ->whitelistedFiles [$ filename ]);
148+ }
132149 }
133150
134151 /**
You can’t perform that action at this time.
0 commit comments