1 | <?php |
||
7 | abstract class AbstractAssignedValueElement extends AbstractAccessRestrictedElement |
||
8 | { |
||
9 | /** |
||
10 | * Use this constant as value to ensure element has not assigned value |
||
11 | * @var unknown |
||
12 | */ |
||
13 | const NO_VALUE = '##NO_VALUE##'; |
||
14 | /** |
||
15 | * @var mixed |
||
16 | */ |
||
17 | protected $value; |
||
18 | /** |
||
19 | * @param string $name |
||
20 | * @param mixed $value |
||
21 | * @param string $access |
||
22 | */ |
||
23 | 162 | public function __construct(string $name, $value = null, string $access = parent::ACCESS_PUBLIC) |
|
28 | /** |
||
29 | * @throws \InvalidArgumentException |
||
30 | * @param mixed $value |
||
31 | * @return AbstractAssignedValueElement |
||
32 | */ |
||
33 | 162 | public function setValue($value): AbstractAssignedValueElement |
|
41 | /** |
||
42 | * @return mixed |
||
43 | */ |
||
44 | 128 | public function getValue() |
|
48 | /** |
||
49 | * @return bool |
||
50 | */ |
||
51 | 128 | public function hasValue(): bool |
|
55 | /** |
||
56 | * @return mixed |
||
57 | */ |
||
58 | 128 | public function getPhpValue() |
|
65 | /** |
||
66 | * @return mixed |
||
67 | */ |
||
68 | 110 | protected function getFinalValue() |
|
77 | /** |
||
78 | * @param mixed $value |
||
79 | * @return mixed |
||
80 | */ |
||
81 | 62 | protected function getScalarValue($value) |
|
91 | /** |
||
92 | * @param mixed $value |
||
93 | * @return string |
||
94 | */ |
||
95 | 76 | protected function getAnyValue($value): string |
|
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | 128 | public function getPhpDeclaration(): string |
|
111 | /** |
||
112 | * returns the way the assignment is declared |
||
113 | * @return string |
||
114 | */ |
||
115 | abstract public function getAssignmentDeclarator(): string; |
||
116 | /** |
||
117 | * returns the way the value is assigned to the element |
||
118 | * @returns string |
||
119 | */ |
||
120 | abstract public function getAssignmentSign(): string; |
||
121 | /** |
||
122 | * returns the way the assignment is finished |
||
123 | * @return string |
||
124 | */ |
||
125 | abstract public function getAssignmentFinishing(): string; |
||
126 | /** |
||
127 | * indicates if the element accepts non scalar value |
||
128 | * @return bool |
||
129 | */ |
||
130 | abstract public function getAcceptNonScalarValue(): bool; |
||
131 | /** |
||
132 | * indicates if the element finishes with a semicolon or not |
||
133 | * @return bool |
||
134 | */ |
||
135 | abstract public function endsWithSemicolon(): bool; |
||
136 | } |
||
137 |