ObjectType   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 5
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A describe() 0 3 1
A __construct() 0 3 1
A acceptsNull() 0 3 1
A validate() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata\Type;
6
7
use function is_object;
8
9
final class ObjectType implements Type
10
{
11
    /** @var string */
12
    private $name;
13
14 38
    public function __construct(string $name)
15
    {
16 38
        $this->name = $name;
17 38
    }
18
19 7
    public function describe() : string
20
    {
21 7
        return $this->name;
22
    }
23
24
    /**
25
     * @param mixed $value
26
     */
27 24
    public function validate($value) : bool
28
    {
29 24
        return is_object($value) && $value instanceof $this->name;
30
    }
31
32 4
    public function acceptsNull() : bool
33
    {
34 4
        return false;
35
    }
36
}
37