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

api-platform / core / 19250029811

10 Nov 2025 11:56PM UTC coverage: 24.566% (+24.6%) from 0.0%
19250029811

push

github

soyuka
ci: ignore no-unnecessary-combinator

14095 of 57375 relevant lines covered (24.57%)

26.48 hits per line

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

42.86
/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

20
final class ObjectMapper implements ObjectMapperInterface
21
{
22
    public function __construct(private ObjectMapperInterface $decorated)
23
    {
24
        if ($this->decorated instanceof ObjectMapperAwareInterface) {
706✔
25
            $this->decorated = $this->decorated->withObjectMapper($this);
706✔
26
        }
27
    }
28

29
    public function map(object $source, object|string|null $target = null): object
30
    {
31
        return $this->decorated->map($source, $target);
10✔
32
    }
33

34
    public function withObjectMapper(ObjectMapperInterface $objectMapper): static
35
    {
36
        if (!$this->decorated instanceof ObjectMapperAwareInterface) {
×
37
            throw new RuntimeException(\sprintf('Given object mapper "%s" does not implements %s.', get_debug_type($this->decorated), ObjectMapperAwareInterface::class));
×
38
        }
39

40
        $this->decorated->withObjectMapper($objectMapper);
×
41

42
        return $this;
×
43
    }
44
}
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