Skip to content

Commit 9d3bae5

Browse files
committed
allow exclude patterns for ClassesScanner
1 parent 6a5c942 commit 9d3bae5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

dev/tools/Magento/Tools/Di/Code/Reader/ClassesScanner.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010

1111
class ClassesScanner
1212
{
13+
/**
14+
* @var array
15+
*/
16+
protected $excludePatterns = [];
17+
18+
/**
19+
* adds exclude patterns
20+
*
21+
* @param array $excludePatterns
22+
*/
23+
public function addExcludePatterns(array $excludePatterns)
24+
{
25+
$this->excludePatterns = array_merge($this->excludePatterns, $excludePatterns);
26+
}
27+
1328
/**
1429
* Retrieves list of classes for given path
1530
*
@@ -37,6 +52,11 @@ public function getList($path)
3752
if ($fileItem->getExtension() !== 'php') {
3853
continue;
3954
}
55+
foreach ($this->excludePatterns as $excludePattern) {
56+
if (preg_match($excludePattern, $fileItem->getRealPath())) {
57+
continue 2;
58+
}
59+
}
4060
$fileScanner = new FileScanner($fileItem->getRealPath());
4161
$classNames = $fileScanner->getClassNames();
4262
foreach ($classNames as $className) {

0 commit comments

Comments
 (0)