doyolabs /
code-coverage-bridge
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the doyo/code-coverage project. |
||
| 5 | * |
||
| 6 | * (c) Anthonius Munthi <[email protected]> |
||
| 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\Compiler; |
||
| 15 | |||
| 16 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
||
|
0 ignored issues
–
show
|
|||
| 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use Symfony\Component\DependencyInjection\Definition; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\DependencyInjection\Definition was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 19 | use Symfony\Component\DependencyInjection\Reference; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\DependencyInjection\Reference was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | |||
| 21 | class ReportPass implements CompilerPassInterface |
||
| 22 | { |
||
| 23 | public function process(ContainerBuilder $container) |
||
| 24 | { |
||
| 25 | $reports = $container->getParameter('reports'); |
||
| 26 | foreach ($reports as $type => $config) { |
||
| 27 | $this->processConfig($container, $type, $config); |
||
| 28 | } |
||
| 29 | |||
| 30 | $coverage = $container->getDefinition('coverage'); |
||
| 31 | $coverage->addMethodCall('addSubscriber', [new Reference('report')]); |
||
| 32 | } |
||
| 33 | |||
| 34 | private function processConfig(ContainerBuilder $container, $type, $config) |
||
| 35 | { |
||
| 36 | if (!isset($config['target'])) { |
||
| 37 | return; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ('text' !== $type) { |
||
| 41 | $config['target'] = getcwd().\DIRECTORY_SEPARATOR.$config['target']; |
||
| 42 | } |
||
| 43 | $report = $container->getDefinition('report'); |
||
| 44 | |||
| 45 | $id = 'reports.'.$type; |
||
| 46 | $class = $container->getParameter($id.'.class'); |
||
| 47 | |||
| 48 | $definition = new Definition($class); |
||
| 49 | $definition->addArgument($config); |
||
| 50 | $definition->setPublic(true); |
||
| 51 | |||
| 52 | $container->setDefinition($id, $definition); |
||
| 53 | |||
| 54 | $report->addMethodCall('addProcessor', [new Reference($id)]); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths