1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the doyo/code-coverage project. |
5
|
|
|
* |
6
|
|
|
* (c) Anthonius Munthi <https://itstoni.com> |
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
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Doyo\Bridge\CodeCoverage\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Doyo\Bridge\CodeCoverage\Configuration; |
17
|
|
|
use Symfony\Component\Config\FileLocator; |
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
19
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
20
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
21
|
|
|
|
22
|
|
|
class CodeCoverageExtension extends Extension |
23
|
|
|
{ |
24
|
35 |
|
public function load(array $configs, ContainerBuilder $container) |
25
|
|
|
{ |
26
|
35 |
|
$locator = new FileLocator(__DIR__.'/../Resources/config'); |
27
|
35 |
|
$loader = new XmlFileLoader($container, $locator); |
28
|
|
|
|
29
|
35 |
|
$configuration = $this->processConfiguration(new Configuration(), $configs); |
30
|
|
|
|
31
|
35 |
|
$container->setParameter('config', $configuration); |
32
|
35 |
|
$container->setParameter('reports', $configuration['reports']); |
33
|
35 |
|
$container->setParameter('config.filter', $configuration['filter']); |
34
|
35 |
|
$container->setParameter('coverage.options', $configuration['coverage']); |
35
|
35 |
|
$container->setParameter('sessions', $configuration['sessions']); |
36
|
|
|
|
37
|
35 |
|
$loader->load('code_coverage.xml'); |
38
|
35 |
|
$loader->load('reports.xml'); |
39
|
|
|
} |
40
|
|
|
|
41
|
35 |
|
public function getAlias() |
42
|
|
|
{ |
43
|
35 |
|
return 'coverage'; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|