ObjectType::describe()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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