1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Visithor package. |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
* |
9
|
|
|
* Feel free to edit as you please, and have fun. |
10
|
|
|
* |
11
|
|
|
* @author Marc Morera <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Visithor\Bundle\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Config\FileLocator; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
19
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class VisithorExtension |
23
|
|
|
*/ |
24
|
|
|
class VisithorExtension extends Extension |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Loads a specific configuration. |
28
|
|
|
* |
29
|
|
|
* @param array $config An array of configuration values |
30
|
|
|
* @param ContainerBuilder $container A ContainerBuilder instance |
31
|
|
|
* |
32
|
|
|
* @throws \InvalidArgumentException When provided tag is not defined in this extension |
33
|
|
|
* |
34
|
|
|
* @api |
35
|
|
|
*/ |
36
|
|
|
public function load(array $config, ContainerBuilder $container) |
37
|
|
|
{ |
38
|
|
|
$loader = new YamlFileLoader( |
39
|
|
|
$container, new |
40
|
|
|
FileLocator(__DIR__ . '/../Resources/config') |
41
|
|
|
); |
42
|
|
|
|
43
|
|
|
$loader->load('clients.yml'); |
44
|
|
|
$loader->load('commands.yml'); |
45
|
|
|
$loader->load('factories.yml'); |
46
|
|
|
$loader->load('generators.yml'); |
47
|
|
|
$loader->load('executors.yml'); |
48
|
|
|
$loader->load('renderers.yml'); |
49
|
|
|
$loader->load('environmentBuilders.yml'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function getAlias() |
56
|
|
|
{ |
57
|
|
|
return 'visithor'; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|