1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the syntaxhighlighter-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SyntaxHighlighterBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
15
|
|
|
use Symfony\Component\Config\FileLocator; |
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
17
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
18
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* SyntaxHighlighter extension. |
22
|
|
|
* |
23
|
|
|
* @author webeweb <https://github.com/webeweb/> |
24
|
|
|
* @package WBW\Bundle\SyntaxHighlighterBundle\DependencyInjection |
25
|
|
|
*/ |
26
|
|
|
class WBWSyntaxHighlighterExtension extends Extension { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritDoc} |
30
|
|
|
*/ |
31
|
|
|
public function getAlias() { |
32
|
|
|
return "wbw_syntaxhighlighter"; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* {@inheritDoc} |
37
|
|
|
*/ |
38
|
|
|
public function load(array $configs, ContainerBuilder $container) { |
39
|
|
|
|
40
|
|
|
$fileLocator = new FileLocator(__DIR__ . "/../Resources/config"); |
41
|
|
|
|
42
|
|
|
$serviceLoader = new YamlFileLoader($container, $fileLocator); |
43
|
|
|
$serviceLoader->load("services.yml"); |
44
|
|
|
|
45
|
|
|
/** @var ConfigurationInterface $configuration */ |
46
|
|
|
$configuration = $this->getConfiguration($configs, $container); |
47
|
|
|
|
48
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
49
|
|
|
|
50
|
|
|
if (true === $config["twig"]) { |
51
|
|
|
$serviceLoader->load("twig.yml"); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|