Total Complexity | 10 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class Variable |
||
14 | { |
||
15 | /** @var string */ |
||
16 | protected $name; |
||
17 | |||
18 | /** @var TypeDeclaration */ |
||
19 | protected $type; |
||
20 | |||
21 | 129 | protected function __construct(string $name, TypeDeclaration $type) |
|
25 | 129 | } |
|
26 | |||
27 | 87 | public static function declaredWith(string $name, TypeDeclaration $type = null): Variable |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * An attribute is a reference if it has a type and it's not a built-in type |
||
34 | * |
||
35 | * This is used when building the digraph and the option `createAssociations` is set |
||
36 | */ |
||
37 | 27 | public function isAReference(): bool |
|
38 | { |
||
39 | 27 | return $this->hasType() && !$this->isBuiltIn(); |
|
40 | } |
||
41 | |||
42 | 27 | private function hasType(): bool |
|
43 | { |
||
44 | 27 | return $this->type->isPresent(); |
|
45 | } |
||
46 | |||
47 | 24 | private function isBuiltIn(): bool |
|
50 | } |
||
51 | |||
52 | 6 | public function name(): string |
|
53 | { |
||
54 | 6 | return $this->name; |
|
55 | } |
||
56 | |||
57 | 18 | public function type(): TypeDeclaration |
|
60 | } |
||
61 | |||
62 | 27 | public function __toString() |
|
71 |