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

api-platform / core / 18283705710

06 Oct 2025 02:10PM UTC coverage: 0.0% (-22.0%) from 21.956%
18283705710

Pull #7397

github

web-flow
Merge 7d799953b into e52e825db
Pull Request #7397: fix(jsonschema/jsonld): make `@id` and `@type` properties required only in the JSON-LD schema for output

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

12313 existing lines in 405 files now uncovered.

0 of 56347 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/State/Processor/ObjectMapperProcessor.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\State\Processor;
15

16
use ApiPlatform\Metadata\Operation;
17
use ApiPlatform\State\ObjectMapper\ClearObjectMapInterface;
18
use ApiPlatform\State\ProcessorInterface;
19
use Symfony\Component\ObjectMapper\Attribute\Map;
20
use Symfony\Component\ObjectMapper\ObjectMapperInterface;
21

22
/**
23
 * @implements ProcessorInterface<mixed,mixed>
24
 */
25
final class ObjectMapperProcessor implements ProcessorInterface
26
{
27
    /**
28
     * @param ProcessorInterface<mixed,mixed> $decorated
29
     */
30
    public function __construct(
31
        private readonly ?ObjectMapperInterface $objectMapper,
32
        private readonly ProcessorInterface $decorated,
33
    ) {
UNCOV
34
    }
×
35

36
    public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): object|array|null
37
    {
38
        if (
39
            !$this->objectMapper
×
UNCOV
40
            || !$operation->canWrite()
×
UNCOV
41
            || !is_a($data, $operation->getClass(), true)
×
UNCOV
42
            || !(new \ReflectionClass($operation->getClass()))->getAttributes(Map::class)
×
43
        ) {
UNCOV
44
            return $this->decorated->process($data, $operation, $uriVariables, $context);
×
45
        }
46

UNCOV
47
        $data = $this->objectMapper->map($this->decorated->process($this->objectMapper->map($data), $operation, $uriVariables, $context), $operation->getClass());
×
48

UNCOV
49
        if ($this->objectMapper instanceof ClearObjectMapInterface) {
×
UNCOV
50
            $this->objectMapper->clearObjectMap();
×
51
        }
52

UNCOV
53
        return $data;
×
54
    }
55
}
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