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

systemsdk / docker-symfony-api / #74

pending completion
#74

push

DKravtsov
Php 8.2, symfony 6.2, updated RabbitMQ, updated composer dependencies, refactoring.

51 of 51 new or added lines in 44 files covered. (100.0%)

1479 of 2668 relevant lines covered (55.43%)

23.59 hits per line

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

40.0
/src/General/Transport/EventSubscriber/ResponseSubscriber.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\General\Transport\EventSubscriber;
6

7
use App\Tool\Application\Service\VersionService;
8
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
9
use Symfony\Component\HttpKernel\Event\ResponseEvent;
10

11
/**
12
 * Class ResponseSubscriber
13
 *
14
 * @package App\General
15
 */
16
class ResponseSubscriber implements EventSubscriberInterface
17
{
18
    public function __construct(
19
        private readonly VersionService $version,
20
    ) {
21
    }
145✔
22

23
    /**
24
     * {@inheritdoc}
25
     *
26
     * @return array<string, array<int, string|int>>
27
     */
28
    public static function getSubscribedEvents(): array
29
    {
30
        return [
×
31
            ResponseEvent::class => [
×
32
                'onKernelResponse',
×
33
                10,
×
34
            ],
×
35
        ];
×
36
    }
37

38
    /**
39
     * Subscriber method to attach API version to every response.
40
     */
41
    public function onKernelResponse(ResponseEvent $event): void
42
    {
43
        // Attach new header
44
        $event->getResponse()->headers->add([
145✔
45
            'X-API-VERSION' => $this->version->get(),
145✔
46
        ]);
145✔
47
    }
48
}
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