-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPresentationsPass.php
33 lines (26 loc) · 1.12 KB
/
PresentationsPass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Orbitale\Bundle\EasyImpressBundle\DependencyInjection\Compiler;
use Orbitale\Bundle\EasyImpressBundle\Configuration\ConfigProcessor;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Finder\Finder;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class PresentationsPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$finder = (new Finder())
->files()
->name('*.{yaml,yml}')
->in($container->getParameter('easy_impress.presentations_dir'))
;
$configProcessor = new ConfigProcessor();
$presentations = [];
foreach ($finder as $file) {
/** @var \SplFileInfo $file */
$container->addResource(new FileResource($file->getRealPath()));
$presentations[preg_replace('~\.ya?ml$~', '', $file->getBasename())] = $configProcessor->processConfigurationFile($file);
}
$container->setParameter('easy_impress.presentations', $presentations);
}
}