| Conditions | 5 |
| Paths | 7 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5.0061 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 1 | public function locate($source) |
|
| 34 | { |
||
| 35 | 1 | $sources = []; |
|
| 36 | 1 | $normalizedSources = []; |
|
| 37 | |||
| 38 | 1 | if (is_dir($source)) { |
|
| 39 | 1 | $finder = new Finder(); |
|
| 40 | 1 | $finder->in($source); |
|
| 41 | |||
| 42 | 1 | foreach ($finder as $file) { |
|
| 43 | 1 | $sources[] = $file; |
|
| 44 | } |
||
| 45 | 1 | } else if (strstr($source, '*') !== false) { |
|
| 46 | // if the source contains a wildcard, we use it with the finder component |
||
| 47 | $sources = $this->getSourcesFromFinder($source); |
||
| 48 | } else { |
||
| 49 | 1 | $sources[] = $source; |
|
| 50 | } |
||
| 51 | |||
| 52 | // each found sources should be normalized |
||
| 53 | 1 | foreach ($sources as $source) { |
|
| 54 | 1 | $normalizedSources[] = $this |
|
| 55 | 1 | ->normalizer |
|
| 56 | 1 | ->normalize($source); |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | return $normalizedSources; |
|
| 60 | } |
||
| 61 | |||
| 100 |