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 | * Attribute constructor. |
||
51 | * |
||
52 | * @param string $name |
||
53 | */ |
||
54 | 7 | public function __construct(string $name, string $getter) |
|
59 | |||
60 | /** |
||
61 | * Get name |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 3 | public function getName(): string |
|
69 | |||
70 | /** |
||
71 | * Get name of getter-method to access value of attribute |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | 1 | public function getGetter(): string |
|
79 | |||
80 | /** |
||
81 | * Set name of data-type |
||
82 | * |
||
83 | * @param string $type |
||
84 | */ |
||
85 | 3 | public function setType(string $type) |
|
89 | |||
90 | /** |
||
91 | * Has data-type defined ? |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | 1 | public function hasType(): bool |
|
99 | |||
100 | /** |
||
101 | * Get name of data-type |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | 4 | public function getType(): string |
|
109 | |||
110 | /** |
||
111 | * Set parameters of data-type handling |
||
112 | * |
||
113 | * @param array $parameters |
||
114 | */ |
||
115 | 3 | public function setTypeParameters(array $parameters) |
|
119 | |||
120 | /** |
||
121 | * Get parameters of data-type handling |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | 4 | public function getTypeParameters(): array |
|
129 | |||
130 | /** |
||
131 | * Set name of property contains related object |
||
132 | * |
||
133 | * @param string $name |
||
134 | */ |
||
135 | 3 | public function setPropertyName(string $name) |
|
139 | |||
140 | /** |
||
141 | * Has name of property ? |
||
142 | * |
||
143 | * @return bool |
||
144 | */ |
||
145 | 1 | public function hasPropertyName(): bool |
|
149 | |||
150 | /** |
||
151 | * Get name of property contains related object |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | 4 | public function getPropertyName(): string |
|
159 | |||
160 | /** |
||
161 | * Merge a attribute into this one |
||
162 | * |
||
163 | * @param self $attribute |
||
164 | */ |
||
165 | 1 | public function merge(self $attribute) |
|
179 | } |