Conditions | 4 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function process(ContainerBuilder $container) |
||
20 | { |
||
21 | $definitionsArray = []; |
||
22 | $definitionsString = []; |
||
23 | $etlFiles = []; |
||
24 | |||
25 | $finder = new Finder(); |
||
26 | |||
27 | foreach ($this->paths as $path) { |
||
28 | if (file_exists($path)) { |
||
29 | $etlFiles = array_merge($etlFiles, iterator_to_array($finder->in([$path])->name("*.yml"))); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | foreach ($etlFiles as $etlFile) { |
||
34 | // Register file so that when it's modified in dev mode symfony empty caches automatially. |
||
35 | $container->fileExists($etlFile); |
||
36 | |||
37 | $etlName = str_replace(".yml", "", $etlFile->getBasename()); |
||
38 | $ymlContent = file_get_contents($etlFile); |
||
39 | |||
40 | $definitionsArray[$etlName] = Yaml::parse($ymlContent); |
||
41 | $definitionsString[$etlName] = $ymlContent; |
||
42 | } |
||
43 | |||
44 | $container->setParameter("oliverde8-php-etl_chain", $definitionsArray); |
||
45 | $container->setParameter("oliverde8-php-etl_chain__string", $definitionsString); |
||
46 | } |
||
47 | } |