| Total Complexity | 9 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class Variable implements HasType |
||
| 16 | { |
||
| 17 | use WithTypeDeclaration; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | protected $name; |
||
| 21 | |||
| 22 | 189 | protected function __construct(string $name, TypeDeclaration $type) |
|
| 23 | { |
||
| 24 | 189 | $this->name = $name; |
|
| 25 | 189 | $this->type = $type; |
|
| 26 | 189 | } |
|
| 27 | |||
| 28 | 117 | public static function declaredWith(string $name, TypeDeclaration $type = null): Variable |
|
| 31 | } |
||
| 32 | |||
| 33 | 57 | public function __toString() |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * References to arrays need to have the `[]` removed from their names in order to create |
||
| 44 | * external definitions with a proper name |
||
| 45 | * |
||
| 46 | * The edges created from these references need to map to the names without the suffix |
||
| 47 | * |
||
| 48 | * @see \PhUml\Parser\Code\ExternalAssociationsResolver::resolveExternalAttributes() |
||
| 49 | * @see \PhUml\Parser\Code\ExternalAssociationsResolver::resolveExternalConstructorParameters() |
||
| 50 | * @see \PhUml\Graphviz\Builders\EdgesBuilder::addAssociation() |
||
| 51 | */ |
||
| 52 | 57 | public function referenceName(): Name |
|
| 55 | } |
||
| 56 | |||
| 57 | 54 | private function typeName(): Name |
|
| 58 | { |
||
| 59 | 54 | return $this->type->name(); |
|
| 60 | } |
||
| 61 | |||
| 62 | 57 | private function isArray(): bool |
|
| 63 | { |
||
| 64 | 57 | return $this->type->isArray(); |
|
| 65 | } |
||
| 66 | |||
| 67 | 3 | private function arrayTypeName(): Name |
|
| 70 | } |
||
| 71 | } |
||
| 72 |