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

api-platform / core / 19337755357

13 Nov 2025 04:03PM UTC coverage: 0.0%. Remained the same
19337755357

push

github

soyuka
Merge 4.2

0 of 298 new or added lines in 18 files covered. (0.0%)

61 existing lines in 11 files now uncovered.

0 of 56962 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/ObjectMapper/ObjectMapper.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\ObjectMapper;
15

16
use ApiPlatform\Metadata\Exception\RuntimeException;
17
use Symfony\Component\ObjectMapper\ObjectMapperAwareInterface;
18
use Symfony\Component\ObjectMapper\ObjectMapperInterface;
19

NEW
20
if (class_exists(ObjectMapperAwareInterface::class)) {
×
21
    final class ObjectMapper implements ObjectMapperInterface
22
    {
23
        public function __construct(private ObjectMapperInterface $decorated)
24
        {
UNCOV
25
        }
×
26

27
        public function map(object $source, object|string|null $target = null): object
28
        {
NEW
29
            return $this->decorated->map($source, $target);
×
30
        }
31
    }
32
} else {
33
    final class ObjectMapper implements ObjectMapperInterface, ObjectMapperAwareInterface
34
    {
35
        public function __construct(private ObjectMapperInterface $decorated)
36
        {
NEW
37
            if ($this->decorated instanceof ObjectMapperAwareInterface) {
×
NEW
38
                $this->decorated = $this->decorated->withObjectMapper($this);
×
39
            }
40
        }
41

42
        public function map(object $source, object|string|null $target = null): object
43
        {
NEW
44
            return $this->decorated->map($source, $target);
×
45
        }
46

47
        public function withObjectMapper(ObjectMapperInterface $objectMapper): static
48
        {
NEW
49
            $s = clone $this;
×
50

NEW
51
            if (!$s->decorated instanceof ObjectMapperAwareInterface) {
×
NEW
52
                throw new RuntimeException(\sprintf('Given object mapper "%s" does not implements %s.', get_debug_type($this->decorated), ObjectMapperAwareInterface::class));
×
53
            }
54

NEW
55
            $s->decorated->withObjectMapper($objectMapper);
×
56

NEW
57
            return $s;
×
58
        }
59
    }
60
}
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