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

DerManoMann / json-object-mapper / 3868897722

pending completion
3868897722

push

github

GitHub
Merge pull request #33 from DerManoMann/refresh

357 of 409 relevant lines covered (87.29%)

33.96 hits per line

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

62.5
/src/TypeReference/ObjectTypeReference.php
1
<?php declare(strict_types=1);
2

3
/*
4
* This file is part of the ObjectMapper library.
5
*
6
* (c) Martin Rademacher <mano@radebatz.net>
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
namespace Radebatz\ObjectMapper\TypeReference;
13

14
use Radebatz\ObjectMapper\TypeReferenceInterface;
15

16
/**
17
 * Type reference to map into an existing value object.
18
 */
19
class ObjectTypeReference implements TypeReferenceInterface
20
{
21
    protected $obj;
22

23
    public function __construct($obj)
24
    {
25
        if (!is_object($obj)) {
5✔
26
            throw new \InvalidArgumentException('Expecting object.');
×
27
        }
28

29
        $this->obj = $obj;
5✔
30
    }
31

32
    /**
33
     * @inheritdoc
34
     */
35
    public function isCollection(): bool
36
    {
37
        return $this->obj instanceof \ArrayObject;
4✔
38
    }
39

40
    /**
41
     * @inheritdoc
42
     */
43
    public function isNullable()
44
    {
45
        return true;
×
46
    }
47

48
    /**
49
     * @inheritdoc
50
     */
51
    public function getType(): string
52
    {
53
        return get_class($this->getObject());
1✔
54
    }
55

56
    public function getObject()
57
    {
58
        return $this->obj;
10✔
59
    }
60

61
    public function setObject($obj)
62
    {
63
        $this->obj = $obj;
×
64
    }
65
}
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