1 | <?php |
||
48 | abstract class AbstractProperties implements PropertiesInterface |
||
49 | { |
||
50 | /** |
||
51 | * Property data |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $data = []; |
||
56 | /** |
||
57 | * Owner object |
||
58 | * |
||
59 | * @var ObjectInterface |
||
60 | */ |
||
61 | protected $object = null; |
||
62 | /** |
||
63 | * Absolute URL property |
||
64 | * |
||
65 | * @var string |
||
66 | */ |
||
67 | const PROPERTY_ABSOLUTE_URL = 'absoluteUrl'; |
||
68 | /** |
||
69 | * Canonical URL property |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | const PROPERTY_CANONICAL_URL = 'canonicalUrl'; |
||
74 | |||
75 | /** |
||
76 | * Meta properties constructor |
||
77 | * |
||
78 | * @param array $data Property data |
||
79 | * @param ObjectInterface $object Owner object |
||
80 | */ |
||
81 | 40 | public function __construct(array $data, ObjectInterface $object) |
|
86 | |||
87 | /** |
||
88 | * Return the owner object |
||
89 | * |
||
90 | * @return ObjectInterface Owner object |
||
91 | */ |
||
92 | 3 | public function getObject() |
|
96 | |||
97 | /** |
||
98 | * Normalize and sort a property value list |
||
99 | * |
||
100 | * @param array $values Property values |
||
101 | * @return array Normalized and sorted property values |
||
102 | */ |
||
103 | 31 | protected function normalizeSortedPropertyValues(array $values) |
|
109 | |||
110 | /** |
||
111 | * Mutate a string property |
||
112 | * |
||
113 | * @param string $property Property name |
||
114 | * @param string $value New value |
||
115 | * @return $this|AbstractProperties Self reference or clone |
||
116 | */ |
||
117 | 3 | protected function mutateStringProperty($property, $value) |
|
130 | |||
131 | /** |
||
132 | * Mutate a float property |
||
133 | * |
||
134 | * @param string $property Property name |
||
135 | * @param float $value New value |
||
136 | * @return $this|AbstractProperties Self reference or clone |
||
137 | */ |
||
138 | 1 | protected function mutateFloatProperty($property, $value) |
|
151 | |||
152 | /** |
||
153 | * Mutate a list property |
||
154 | * |
||
155 | * @param string $property Property name |
||
156 | * @param array $values New values |
||
157 | * @return $this|AbstractProperties Self reference or clone |
||
158 | */ |
||
159 | 1 | protected function mutateListProperty($property, array $values) |
|
171 | |||
172 | /** |
||
173 | * Mutate a neste properties property |
||
174 | * |
||
175 | * @param string $property Property name |
||
176 | * @param PropertiesInterface $value Nested properties |
||
177 | * @return $this|AbstractProperties Self reference or clone |
||
178 | */ |
||
179 | 1 | protected function mutatePropertiesProperty($property, PropertiesInterface $value) |
|
191 | |||
192 | /** |
||
193 | * Return the property values as array |
||
194 | * |
||
195 | * @param bool $serialize Serialize property objects |
||
196 | * @return array Property values |
||
197 | */ |
||
198 | 9 | public function toArray($serialize = true) |
|
202 | |||
203 | /** |
||
204 | * Return the potentially serialized property values |
||
205 | * |
||
206 | * @param boolean $serialize Serialize objects |
||
207 | * @param array $data Property values |
||
208 | * @return array Serialized property values |
||
209 | */ |
||
210 | 9 | protected function toSerializedArray($serialize, array $data) |
|
234 | } |
||
235 |