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

api-platform / core / 16531587208

25 Jul 2025 09:05PM UTC coverage: 0.0% (-22.1%) from 22.07%
16531587208

Pull #7225

github

web-flow
Merge 23f449a58 into 02a764950
Pull Request #7225: feat: json streamer

0 of 294 new or added lines in 31 files covered. (0.0%)

11514 existing lines in 375 files now uncovered.

0 of 51976 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/src/Serializer/OperationContextTrait.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\Serializer;
15

16
use ApiPlatform\Metadata\ApiProperty;
17

18
/**
19
 * @internal
20
 */
21
trait OperationContextTrait
22
{
23
    /**
24
     * This context is created when working on a relation context or items of a collection. It cleans the previously given
25
     * context as the operation changes.
26
     */
27
    protected function createOperationContext(array $context, ?string $resourceClass = null, ?ApiProperty $propertyMetadata = null): array
28
    {
UNCOV
29
        if (isset($context['operation']) && !isset($context['root_operation'])) {
×
UNCOV
30
            $context['root_operation'] = $context['operation'];
×
31
        }
32

UNCOV
33
        if (isset($context['operation_name']) || isset($context['graphql_operation_name'])) {
×
UNCOV
34
            $context['root_operation_name'] = $context['operation_name'] ?? $context['graphql_operation_name'];
×
35
        }
36

UNCOV
37
        unset($context['iri'], $context['uri_variables'], $context['item_uri_template'], $context['force_resource_class']);
×
38

39
        // At some point we should merge the jsonld context here, there's a TODO to simplify this somewhere else
UNCOV
40
        if ($propertyMetadata) {
×
UNCOV
41
            $context['output'] ??= [];
×
UNCOV
42
            $context['output']['gen_id'] = $propertyMetadata->getGenId() ?? true;
×
43
        }
44

UNCOV
45
        if (!$resourceClass) {
×
46
            return $context;
×
47
        }
48

UNCOV
49
        if (($operation = $context['operation'] ?? null) && method_exists($operation, 'getItemUriTemplate')) {
×
UNCOV
50
            $context['item_uri_template'] = $operation->getItemUriTemplate();
×
51
        }
52

UNCOV
53
        unset($context['operation'], $context['operation_name']);
×
UNCOV
54
        $context['resource_class'] = $resourceClass;
×
55

UNCOV
56
        return $context;
×
57
    }
58
}
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