| Conditions | 4 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function load(string $lang): array |
||
| 23 | 15 | { |
|
| 24 | $directories = []; |
||
| 25 | 15 | /** @var SplFileInfo $file */ |
|
| 26 | foreach (Finder::find('*.*.neon')->from(...$this->directories) as $file) { |
||
| 27 | 15 | $matchCount = preg_match( |
|
| 28 | 15 | '~^(?P<prefix>.*?)\.(?P<lang>[^\.]+)\.(?P<format>[^\.]+)$~', |
|
| 29 | $file->getFilename(), |
||
| 30 | $matches |
||
| 31 | ); |
||
| 32 | 15 | ||
| 33 | 15 | if ($matchCount !== 1) { |
|
| 34 | continue; |
||
| 35 | } |
||
| 36 | 15 | ||
| 37 | $resource = new NeonResource($file->getPathname(), $matches['lang'], in_array($matches['prefix'], $this->ignoredPrefixes, true) ? '' : $matches['prefix'] . '.'); |
||
| 38 | $directories[] = $resource->load($lang); |
||
| 39 | } |
||
| 40 | |||
| 41 | return array_merge(...$directories); |
||
| 42 | } |
||
| 44 |