1 | <?php |
||
11 | class Attribute |
||
12 | { |
||
13 | /** |
||
14 | * Name of property contains related object. |
||
15 | * Value is optional. Can be set only for real properties. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $propertyName; |
||
20 | |||
21 | /** |
||
22 | * Unique name of serialized attribute |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $name; |
||
27 | |||
28 | /** |
||
29 | * Data-type |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $type; |
||
34 | |||
35 | /** |
||
36 | * Parameters for data-type handler |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $typeParameters = []; |
||
41 | |||
42 | /** |
||
43 | * Getter-method to access value |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $getter; |
||
48 | |||
49 | /** |
||
50 | * Setter-method to access value |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $setter; |
||
55 | |||
56 | /** |
||
57 | * Attribute constructor. |
||
58 | * |
||
59 | * @param string $name |
||
60 | * @param string $getter |
||
61 | */ |
||
62 | 10 | public function __construct(string $name, string $getter) |
|
67 | |||
68 | /** |
||
69 | * Get name |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | 5 | public function getName(): string |
|
77 | |||
78 | /** |
||
79 | * Get name of getter-method to access value of attribute |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 4 | public function getGetter(): string |
|
87 | |||
88 | /** |
||
89 | * Set name of setter-method to access value of attribute |
||
90 | * |
||
91 | * @param string $name |
||
92 | */ |
||
93 | 3 | public function setSetter(string $name) |
|
97 | |||
98 | /** |
||
99 | * Has setter-method defined ? |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | 3 | public function hasSetter(): bool |
|
107 | |||
108 | /** |
||
109 | * Get name of setter-method to access value of attribute |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | 3 | public function getSetter(): string |
|
117 | |||
118 | /** |
||
119 | * Set name of data-type |
||
120 | * |
||
121 | * @param string $type |
||
122 | */ |
||
123 | 5 | public function setType(string $type) |
|
127 | |||
128 | /** |
||
129 | * Has data-type defined ? |
||
130 | * |
||
131 | * @return bool |
||
132 | */ |
||
133 | 1 | public function hasType(): bool |
|
137 | |||
138 | /** |
||
139 | * Get name of data-type |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | 6 | public function getType(): string |
|
147 | |||
148 | /** |
||
149 | * Set parameters of data-type handling |
||
150 | * |
||
151 | * @param array $parameters |
||
152 | */ |
||
153 | 5 | public function setTypeParameters(array $parameters) |
|
157 | |||
158 | /** |
||
159 | * Get parameters of data-type handling |
||
160 | * |
||
161 | * @return array |
||
162 | */ |
||
163 | 6 | public function getTypeParameters(): array |
|
167 | |||
168 | /** |
||
169 | * Set name of property contains related object |
||
170 | * |
||
171 | * @param string $name |
||
172 | */ |
||
173 | 3 | public function setPropertyName(string $name) |
|
177 | |||
178 | /** |
||
179 | * Has name of property ? |
||
180 | * |
||
181 | * @return bool |
||
182 | */ |
||
183 | 3 | public function hasPropertyName(): bool |
|
187 | |||
188 | /** |
||
189 | * Get name of property contains related object |
||
190 | * |
||
191 | * @return string |
||
192 | */ |
||
193 | 4 | public function getPropertyName(): string |
|
197 | |||
198 | /** |
||
199 | * Merge a attribute into this one |
||
200 | * |
||
201 | * @param self $attribute |
||
202 | */ |
||
203 | 1 | public function merge(self $attribute) |
|
217 | } |