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

DerManoMann / json-object-mapper / 10778033527

09 Sep 2024 05:16PM UTC coverage: 87.286%. Remained the same
10778033527

Pull #35

github

web-flow
Merge eab15aadb into 82479c6e8
Pull Request #35: Update netresearch/jsonmapper requirement from ^3.0 || ^4.0 to ^3.0 || ^4.0 || ^5.0

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

85.71
/src/TypeReference/ClassTypeReference.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 a new instance of `$className`.
18
 */
19
class ClassTypeReference implements TypeReferenceInterface
20
{
21
    protected $className;
22
    protected $nullable;
23

24
    public function __construct(string $className, bool $nullable = true)
25
    {
26
        $this->className = $className;
63✔
27
        $this->nullable = $nullable;
63✔
28
    }
29

30
    /**
31
     * @inheritdoc
32
     */
33
    public function isCollection(): bool
34
    {
35
        return \ArrayObject::class == $this->className || is_subclass_of($this->className, \ArrayObject::class);
62✔
36
    }
37

38
    /**
39
     * @inheritdoc
40
     */
41
    public function isNullable()
42
    {
43
        return $this->nullable;
42✔
44
    }
45

46
    /**
47
     * @inheritdoc
48
     */
49
    public function getType(): string
50
    {
51
        return $this->getClassName();
2✔
52
    }
53

54
    public function getClassName(): string
55
    {
56
        return $this->className;
64✔
57
    }
58

59
    public function setClassName(string $className)
60
    {
61
        $this->className = $className;
×
62
    }
63
}
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