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
22
22
*/
23
23
private $ whitelistedFiles = [];
24
24
25
+ private $ ignoreLists = [];
26
+
27
+ /**
28
+ * @param array $ignoreLists
29
+ */
30
+ public function setIgnoreLists ($ ignoreLists ) {
31
+ $ this ->ignoreLists = $ ignoreLists ;
32
+ }
25
33
/**
26
34
* Adds a directory to the whitelist (recursively).
27
35
*
@@ -127,8 +135,17 @@ public function isFiltered($filename)
127
135
}
128
136
129
137
$ 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 {
131
147
return !isset ($ this ->whitelistedFiles [$ filename ]);
148
+ }
132
149
}
133
150
134
151
/**
You can’t perform that action at this time.
0 commit comments