Completed
Push — master ( 63da89...c06ae3 )
by Alexander
46:48 queued 21:51
created

ReflectionNamedType   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 63
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A allowsNull() 0 4 1
A isBuiltin() 0 4 1
A __toString() 0 4 1
A getName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Parser Reflection API
6
 *
7
 * @copyright Copyright 2021, Lisachenko Alexander <[email protected]>
8
 *
9
 * This source file is subject to the license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Go\ParserReflection;
14
15
use ReflectionNamedType as BaseReflectionNamedType;
16
17
/**
18
 * ReflectionNamedType implementation
19
 */
20
class ReflectionNamedType extends BaseReflectionNamedType
21
{
22
    /**
23
     * If type allows null or not
24
     *
25
     * @var bool
26
     */
27
    private $allowsNull;
28
29
    /**
30
     * Is type built-in or not
31
     *
32
     * @var
33
     */
34
    private $isBuiltin;
35
36
    /**
37
     * @var string Type name
38
     */
39
    private $type;
40
41
    /**
42
     * Initializes reflection data
43
     */
44
    public function __construct($type, $allowsNull, $isBuiltin)
45
    {
46
        $this->type       = $type;
47
        $this->allowsNull = $allowsNull;
48
        $this->isBuiltin  = $isBuiltin;
49
    }
50
51
    /**
52
     * @inheritDoc
53
     */
54
    public function allowsNull()
55
    {
56
        return $this->allowsNull;
57
    }
58
59
    /**
60
     * @inheritDoc
61
     */
62
    public function isBuiltin()
63
    {
64
        return $this->isBuiltin;
65
    }
66
67
    /**
68
     * @inheritDoc
69
     */
70
    public function __toString()
71
    {
72
        return $this->type;
73
    }
74
75
    /**
76
     * @inheritDoc
77
     */
78
    public function getName()
79
    {
80
        return $this->type;
81
    }
82
}
83