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

api-platform / core / 15133993414

20 May 2025 09:30AM UTC coverage: 26.313% (-1.2%) from 27.493%
15133993414

Pull #7161

github

web-flow
Merge e2c03d45f into 5459ba375
Pull Request #7161: fix(metadata): infer parameter string type from schema

0 of 2 new or added lines in 1 file covered. (0.0%)

11019 existing lines in 363 files now uncovered.

12898 of 49018 relevant lines covered (26.31%)

34.33 hits per line

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

84.62
/src/GraphQl/State/Processor/SubscriptionProcessor.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.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 ApiPlatform\GraphQl\State\Processor;
15

16
use ApiPlatform\GraphQl\Subscription\MercureSubscriptionIriGeneratorInterface;
17
use ApiPlatform\GraphQl\Subscription\OperationAwareSubscriptionManagerInterface;
18
use ApiPlatform\GraphQl\Subscription\SubscriptionManagerInterface;
19
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
20
use ApiPlatform\Metadata\Operation;
21
use ApiPlatform\State\ProcessorInterface;
22

23
/**
24
 * Adds the mercure subscription url if available.
25
 */
26
final class SubscriptionProcessor implements ProcessorInterface
27
{
28
    public function __construct(private readonly ProcessorInterface $decorated, private readonly SubscriptionManagerInterface $subscriptionManager, private readonly ?MercureSubscriptionIriGeneratorInterface $mercureSubscriptionIriGenerator)
29
    {
UNCOV
30
    }
148✔
31

32
    public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = [])
33
    {
UNCOV
34
        $data = $this->decorated->process($data, $operation, $uriVariables, $context);
110✔
UNCOV
35
        if (!$operation instanceof GraphQlOperation || !($mercure = $operation->getMercure())) {
110✔
UNCOV
36
            return $data;
109✔
37
        }
38

39
        if ($this->subscriptionManager instanceof OperationAwareSubscriptionManagerInterface) {
1✔
40
            $subscriptionId = $this->subscriptionManager->retrieveSubscriptionId($context, $data, $operation);
1✔
41
        } else {
42
            $subscriptionId = $this->subscriptionManager->retrieveSubscriptionId($context, $data);
×
43
        }
44

45
        if ($subscriptionId) {
1✔
46
            if (!$this->mercureSubscriptionIriGenerator) {
1✔
47
                throw new \LogicException('Cannot use Mercure for subscriptions when MercureBundle is not installed. Try running "composer require mercure".');
×
48
            }
49

50
            $hub = \is_array($mercure) ? ($mercure['hub'] ?? null) : null;
1✔
51
            $data['mercureUrl'] = $this->mercureSubscriptionIriGenerator->generateMercureUrl($subscriptionId, $hub);
1✔
52
        }
53

54
        return $data;
1✔
55
    }
56
}
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