Total Complexity | 10 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class Variable |
||
14 | { |
||
15 | /** @var string */ |
||
16 | protected $name; |
||
17 | |||
18 | /** @var TypeDeclaration */ |
||
19 | protected $type; |
||
20 | |||
21 | protected function __construct(string $name, TypeDeclaration $type) |
||
22 | { |
||
23 | $this->name = $name; |
||
24 | $this->type = $type; |
||
25 | } |
||
26 | |||
27 | 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 | public function isAReference(): bool |
||
38 | { |
||
39 | return $this->hasType() && !$this->isBuiltIn(); |
||
40 | } |
||
41 | |||
42 | private function hasType(): bool |
||
43 | { |
||
44 | return $this->type->isPresent(); |
||
45 | } |
||
46 | |||
47 | private function isBuiltIn(): bool |
||
50 | } |
||
51 | |||
52 | public function name(): string |
||
53 | { |
||
54 | return $this->name; |
||
55 | } |
||
56 | |||
57 | public function type(): TypeDeclaration |
||
60 | } |
||
61 | |||
62 | public function __toString() |
||
71 |