• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarlepp / symfony-flex-backend / #5622

22 Feb 2025 10:59PM UTC coverage: 100.0%. Remained the same
#5622

Pull #2945

php-coveralls

web-flow
Merge ca05c026b into d9edad4e5
Pull Request #2945: Chore(ci) - GitHub actions image update

2299 of 2299 relevant lines covered (100.0%)

92.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Compiler/StopwatchCompilerPass.php
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/Compiler/StopwatchCompilerPass.php
5
 *
6
 * @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
7
 */
8

9
namespace App\Compiler;
10

11
use App\Decorator\StopwatchDecorator;
12
use Override;
13
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Definition;
16
use Symfony\Component\DependencyInjection\Reference;
17
use function str_starts_with;
18

19
/**
20
 * @package App\Compiler
21
 * @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
22
 */
23
class StopwatchCompilerPass implements CompilerPassInterface
24
{
25
    private const array SERVICE_TAGS = [
26
        'security.voter',
27
        'kernel.event_subscriber',
28
        'validator.constraint_validator',
29
        'validator.initializer',
30
        'app.stopwatch',
31
    ];
32

33
    #[Override]
34
    public function process(ContainerBuilder $container): void
35
    {
36
        foreach (self::SERVICE_TAGS as $tag) {
3✔
37
            foreach ($container->findTaggedServiceIds($tag) as $serviceId => $tags) {
3✔
38
                if (!str_starts_with($serviceId, 'App')) {
2✔
39
                    continue;
1✔
40
                }
41

42
                $definition = new Definition($container->getDefinition($serviceId)->getClass());
1✔
43
                $definition->setDecoratedService($serviceId);
1✔
44
                $definition->setFactory([new Reference(StopwatchDecorator::class), 'decorate']);
1✔
45
                $definition->setArguments([new Reference($serviceId . '.stopwatch.inner')]);
1✔
46

47
                $container->setDefinition($serviceId . '.stopwatch', $definition);
1✔
48
            }
49
        }
50
    }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc