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

CPS-IT / frontend-asset-handler / 15251341592

26 May 2025 10:12AM UTC coverage: 99.233%. Remained the same
15251341592

Pull #659

github

web-flow
Merge c6e7b1587 into 8b95d2cff
Pull Request #659: [TASK] Update phpunit/phpunit to v12

2459 of 2478 relevant lines covered (99.23%)

15.09 hits per line

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

76.92
/src/DependencyInjection/CompilerPass/EnvironmentTransformerCompilerPass.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "cpsit/frontend-asset-handler".
7
 *
8
 * Copyright (C) 2022 Elias Häußler <e.haeussler@familie-redlich.de>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace CPSIT\FrontendAssetHandler\DependencyInjection\CompilerPass;
25

26
use CPSIT\FrontendAssetHandler\Asset;
27
use CPSIT\FrontendAssetHandler\Exception;
28
use RuntimeException;
29
use Symfony\Component\DependencyInjection;
30

31
use function call_user_func;
32
use function is_a;
33

34
/**
35
 * EnvironmentTransformerCompilerPass.
36
 *
37
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
38
 * @license GPL-3.0-or-later
39
 *
40
 * @internal
41
 */
42
final class EnvironmentTransformerCompilerPass implements DependencyInjection\Compiler\CompilerPassInterface
43
{
44
    public function process(DependencyInjection\ContainerBuilder $container): void
47✔
45
    {
46
        $serviceIds = $container->findTaggedServiceIds('asset_environment.transformer');
47✔
47
        $transformers = [];
47✔
48

49
        foreach ($serviceIds as $serviceId => $tags) {
47✔
50
            if (!$container->hasDefinition($serviceId) || ($service = $container->findDefinition($serviceId))->isAbstract()) {
47✔
51
                continue;
×
52
            }
53

54
            if (null === ($className = $service->getClass())) {
47✔
55
                throw new RuntimeException(sprintf('Unable to determine class name for service "%s".', $serviceId), 1644422571);
×
56
            }
57
            /** @var class-string $className */
58
            if (!is_a($className, Asset\Environment\Transformer\TransformerInterface::class, true)) {
47✔
59
                throw Exception\UnsupportedClassException::create($className);
×
60
            }
61

62
            /** @var class-string<Asset\Environment\Transformer\TransformerInterface> $className */
63
            $name = call_user_func([$className, 'getName']);
47✔
64
            $transformers[$name] = $className;
47✔
65
        }
66

67
        $container->setParameter('asset_environment.transformers', $transformers);
47✔
68
    }
69
}
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

© 2025 Coveralls, Inc