File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
dev/tools/Magento/Tools/Di/Code/Scanner Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ class DirectoryScanner
12
12
*
13
13
* @param string $dir
14
14
* @param array $patterns
15
+ * @param string[] $excludePatterns
15
16
* @return array
16
17
*/
17
- public function scan ($ dir , array $ patterns = [])
18
+ public function scan ($ dir , array $ patterns = [], array $ excludePatterns = [] )
18
19
{
19
20
$ recursiveIterator = new \RecursiveIteratorIterator (
20
21
new \RecursiveDirectoryIterator ($ dir , \FilesystemIterator::FOLLOW_SYMLINKS )
@@ -27,6 +28,13 @@ public function scan($dir, array $patterns = [])
27
28
}
28
29
29
30
$ filePath = str_replace ('\\' , '/ ' , $ file ->getRealPath ());
31
+ if (!empty ($ excludePatterns )) {
32
+ foreach ($ excludePatterns as $ excludePattern ) {
33
+ if (preg_match ($ excludePattern , $ filePath )) {
34
+ continue 2 ;
35
+ }
36
+ }
37
+ }
30
38
foreach ($ patterns as $ type => $ pattern ) {
31
39
if (preg_match ($ pattern , $ filePath )) {
32
40
$ output [$ type ][] = $ filePath ;
You can’t perform that action at this time.
0 commit comments