Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | public function find(): \ArrayObject |
||
34 | { |
||
35 | $this->finder |
||
36 | ->files() |
||
37 | ->name(self::DEPLOY_FILENAME_PATTERN) |
||
38 | ->depth("<= 2") |
||
39 | ->sort(function(\SplFileInfo $a, \SplFileInfo $b){ |
||
40 | $sortNameA = substr($a->getBasename(), strpos($a->getBasename(), '_')+1); |
||
41 | $sortNameB = substr($b->getBasename(), strpos($b->getBasename(), '_')+1); |
||
42 | return strcmp($sortNameA, $sortNameB); |
||
43 | }) |
||
44 | ->in([$this->searchRoot]); |
||
45 | |||
46 | $classMap = new \ArrayObject(); |
||
47 | foreach($this->finder as $file){ |
||
48 | $filename = $file->getBasename(); |
||
49 | $className = substr($filename, 0, strrpos($filename, '.')); |
||
50 | |||
51 | $classMap[$className] = $file->getRealPath(); |
||
52 | } |
||
53 | |||
54 | return $classMap; |
||
55 | } |
||
57 |