1 | <?php |
||
18 | class Type implements TypeInterface |
||
19 | { |
||
20 | use Serializable; |
||
21 | |||
22 | /** |
||
23 | * @var Type[] |
||
24 | */ |
||
25 | private static $instances = []; |
||
26 | |||
27 | /** |
||
28 | * @var array[]|string[][] |
||
29 | */ |
||
30 | private static $inheritance = []; |
||
31 | |||
32 | /** |
||
33 | * @var array|string[] |
||
34 | */ |
||
35 | private $parent; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $name; |
||
41 | |||
42 | /** |
||
43 | * BaseType constructor. |
||
44 | * @param string $name |
||
45 | */ |
||
46 | 9 | private function __construct(string $name) |
|
53 | |||
54 | /** |
||
55 | * @param string $name |
||
56 | * @return array |
||
57 | */ |
||
58 | 9 | private function getInheritanceSequence(string $name): array |
|
66 | |||
67 | /** |
||
68 | * @param \SplStack $stack |
||
69 | * @param array $children |
||
70 | */ |
||
71 | private function bootInheritance(\SplStack $stack, array $children = []): void |
||
95 | |||
96 | /** |
||
97 | * @param string $type |
||
98 | * @return Type |
||
99 | */ |
||
100 | 130 | public static function of(string $type): Type |
|
104 | |||
105 | /** |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function isDependent(): bool |
||
112 | |||
113 | /** |
||
114 | * @param TypeInterface $type |
||
115 | * @return bool |
||
116 | */ |
||
117 | 130 | public function instanceOf(TypeInterface $type): bool |
|
123 | |||
124 | /** |
||
125 | * @param string $type |
||
126 | * @return bool |
||
127 | */ |
||
128 | 130 | public function is(string $type): bool |
|
132 | |||
133 | /** |
||
134 | * @return string |
||
135 | */ |
||
136 | 130 | public function getName(): string |
|
140 | |||
141 | /** |
||
142 | * @return string |
||
143 | */ |
||
144 | 106 | public function __toString(): string |
|
148 | } |
||
149 |