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

api-platform / core / 14664641376

25 Apr 2025 12:30PM UTC coverage: 7.02%. First build
14664641376

Pull #6904

github

web-flow
Merge decfc5b24 into 7c796de0d
Pull Request #6904: feat(graphql): added support for graphql subscriptions to work for actions

55 of 192 new or added lines in 9 files covered. (28.65%)

11165 of 159046 relevant lines covered (7.02%)

6.23 hits per line

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

0.0
/src/GraphQl/Subscription/SubscriptionIdentifierGenerator.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\Subscription;
15

16
/**
17
 * Generates an identifier used to identify a subscription.
18
 *
19
 * @author Alan Poulain <contact@alanpoulain.eu>
20
 */
21
final class SubscriptionIdentifierGenerator implements SubscriptionIdentifierGeneratorInterface
22
{
23
    public function generateSubscriptionIdentifier(array $fields): string
24
    {
25
        unset($fields['mercureUrl'], $fields['clientSubscriptionId']);
×
NEW
26
        $fields = $this->removeTypename($fields);
×
27

28
        return hash('sha256', print_r($fields, true));
×
29
    }
30

31
    private function removeTypename(array $data): array
32
    {
NEW
33
        foreach ($data as $key => $value) {
×
NEW
34
            if ('__typename' === $key) {
×
NEW
35
                unset($data[$key]);
×
NEW
36
            } elseif (\is_array($value)) {
×
NEW
37
                $data[$key] = $this->removeTypename($value);
×
38
            }
39
        }
40

NEW
41
        return $data;
×
42
    }
43
}
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