Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function locateFiles(array $bundles, string $environment): array |
||
15 | { |
||
16 | $path = sprintf('%s/../Resources/fixtures', __DIR__); |
||
17 | $path = realpath($path); |
||
18 | if (false === $path || false === file_exists($path)) { |
||
19 | return []; |
||
20 | } |
||
21 | |||
22 | $files = SymfonyFinder::create()->files()->in($path)->depth(0)->name('/.*\.(ya?ml|php)$/i'); |
||
23 | |||
24 | // this sort helps to set an order with filename ( "001-root-level-fixtures.yml", "002-another-level-fixtures.yml", ... ) |
||
25 | $files = $files->sort(function ($a, $b) { |
||
26 | return strcasecmp($a, $b); |
||
27 | }); |
||
28 | |||
29 | $fixtureFiles = []; |
||
30 | foreach ($files as $file) { |
||
31 | $fixtureFiles[] = $file->getRealPath(); |
||
32 | } |
||
33 | |||
34 | return $fixtureFiles; |
||
35 | } |
||
36 | } |
||
37 |