@@ -19,220 +19,220 @@ discard block |
||
19 | 19 | |
20 | 20 | public static $index=0; |
21 | 21 | |
22 | - public function __construct($identifier,$instance=NULL,$captions=NULL){ |
|
22 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
23 | 23 | $this->widgetIdentifier=$identifier; |
24 | 24 | $this->values=[]; |
25 | 25 | $this->afterCompile=[]; |
26 | - if(isset($instance)) |
|
26 | + if (isset($instance)) |
|
27 | 27 | $this->setInstance($instance); |
28 | 28 | $this->setCaptions($captions); |
29 | 29 | $this->captionCallback=NULL; |
30 | - $this->defaultValueFunction=function($name,$value){return $value;}; |
|
30 | + $this->defaultValueFunction=function($name, $value) {return $value; }; |
|
31 | 31 | } |
32 | 32 | |
33 | - public function moveFieldTo($from,$to){ |
|
34 | - if(JArray::moveElementTo($this->visibleProperties, $from, $to)){ |
|
33 | + public function moveFieldTo($from, $to) { |
|
34 | + if (JArray::moveElementTo($this->visibleProperties, $from, $to)) { |
|
35 | 35 | return JArray::moveElementTo($this->values, $from, $to); |
36 | 36 | } |
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - public function swapFields($index1,$index2){ |
|
41 | - if(JArray::swapElements($this->visibleProperties, $index1, $index2)){ |
|
40 | + public function swapFields($index1, $index2) { |
|
41 | + if (JArray::swapElements($this->visibleProperties, $index1, $index2)) { |
|
42 | 42 | return JArray::swapElements($this->values, $index1, $index2); |
43 | 43 | } |
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
47 | - public function removeField($index){ |
|
48 | - \array_splice($this->visibleProperties,$index,1); |
|
49 | - \array_splice($this->values,$index,1); |
|
50 | - \array_splice($this->captions,$index,1); |
|
47 | + public function removeField($index) { |
|
48 | + \array_splice($this->visibleProperties, $index, 1); |
|
49 | + \array_splice($this->values, $index, 1); |
|
50 | + \array_splice($this->captions, $index, 1); |
|
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 | |
54 | - public function getValues(){ |
|
54 | + public function getValues() { |
|
55 | 55 | $values=[]; |
56 | 56 | $index=0; |
57 | 57 | $count=$this->count(); |
58 | - while($index<$count){ |
|
58 | + while ($index<$count) { |
|
59 | 59 | $values[]=$this->getValue($index++); |
60 | 60 | } |
61 | 61 | return $values; |
62 | 62 | } |
63 | 63 | |
64 | - public function getIdentifier($index=NULL){ |
|
65 | - if(!isset($index)) |
|
64 | + public function getIdentifier($index=NULL) { |
|
65 | + if (!isset($index)) |
|
66 | 66 | $index=self::$index; |
67 | 67 | $value=$index; |
68 | - if(isset($this->values["identifier"])){ |
|
69 | - if(\is_string($this->values["identifier"])) |
|
68 | + if (isset($this->values["identifier"])) { |
|
69 | + if (\is_string($this->values["identifier"])) |
|
70 | 70 | $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
71 | 71 | else |
72 | - $value=$this->values["identifier"]($index,$this->instance); |
|
72 | + $value=$this->values["identifier"]($index, $this->instance); |
|
73 | 73 | } |
74 | 74 | return $value; |
75 | 75 | } |
76 | 76 | |
77 | - public function getValue($index){ |
|
77 | + public function getValue($index) { |
|
78 | 78 | $property=$this->properties[$index]; |
79 | 79 | return $this->_getValue($property, $index); |
80 | 80 | } |
81 | 81 | |
82 | - protected function _beforeAddProperty($index,&$field){ |
|
82 | + protected function _beforeAddProperty($index, &$field) { |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - protected function _getDefaultValue($name,$value,$index){ |
|
86 | + protected function _getDefaultValue($name, $value, $index) { |
|
87 | 87 | $func=$this->defaultValueFunction; |
88 | - return $func($name,$value,$index,$this->instance); |
|
88 | + return $func($name, $value, $index, $this->instance); |
|
89 | 89 | } |
90 | 90 | |
91 | - protected function _getPropertyValue(\ReflectionProperty $property,$index){ |
|
91 | + protected function _getPropertyValue(\ReflectionProperty $property, $index) { |
|
92 | 92 | $property->setAccessible(true); |
93 | 93 | return $property->getValue($this->instance); |
94 | 94 | } |
95 | 95 | |
96 | - protected function _getValue($property,$index){ |
|
96 | + protected function _getValue($property, $index) { |
|
97 | 97 | $value=null; |
98 | 98 | $propertyName=$property; |
99 | - if($property instanceof \ReflectionProperty){ |
|
99 | + if ($property instanceof \ReflectionProperty) { |
|
100 | 100 | $value=$this->_getPropertyValue($property, $index); |
101 | 101 | $propertyName=$property->getName(); |
102 | - }elseif(\is_array($property)){ |
|
103 | - $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
|
102 | + }elseif (\is_array($property)) { |
|
103 | + $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property); |
|
104 | 104 | $value=\implode("", $values); |
105 | - }elseif(\is_string($property)){ |
|
105 | + }elseif (\is_string($property)) { |
|
106 | 106 | $value=$property; |
107 | - if(isset($this->instance->{$property})){ |
|
107 | + if (isset($this->instance->{$property})) { |
|
108 | 108 | $value=$this->instance->{$property}; |
109 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
109 | + }elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) { |
|
110 | 110 | $value=JReflection::callMethod($this->instance, $getter, []); |
111 | 111 | } |
112 | - }elseif(\is_callable($property)){ |
|
112 | + }elseif (\is_callable($property)) { |
|
113 | 113 | $value=$property($this->instance); |
114 | 114 | } |
115 | 115 | return $this->_postGetValue($index, $propertyName, $value); |
116 | 116 | } |
117 | 117 | |
118 | - protected function _postGetValue($index,$propertyName,$value){ |
|
119 | - if(isset($this->values[$index])){ |
|
120 | - $value= $this->values[$index]($value,$this->instance,$index); |
|
121 | - }else{ |
|
122 | - $value=$this->_getDefaultValue($propertyName,$value, $index); |
|
118 | + protected function _postGetValue($index, $propertyName, $value) { |
|
119 | + if (isset($this->values[$index])) { |
|
120 | + $value=$this->values[$index]($value, $this->instance, $index); |
|
121 | + } else { |
|
122 | + $value=$this->_getDefaultValue($propertyName, $value, $index); |
|
123 | 123 | } |
124 | - if(isset($this->afterCompile[$index])){ |
|
125 | - if(\is_callable($this->afterCompile[$index])){ |
|
126 | - $this->afterCompile[$index]($value,$this->instance,$index); |
|
124 | + if (isset($this->afterCompile[$index])) { |
|
125 | + if (\is_callable($this->afterCompile[$index])) { |
|
126 | + $this->afterCompile[$index]($value, $this->instance, $index); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | return $value; |
130 | 130 | } |
131 | 131 | |
132 | - public function insertField($index,$field){ |
|
133 | - array_splice( $this->visibleProperties, $index, 0, $field ); |
|
132 | + public function insertField($index, $field) { |
|
133 | + array_splice($this->visibleProperties, $index, 0, $field); |
|
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
137 | - public function insertInField($index,$field){ |
|
137 | + public function insertInField($index, $field) { |
|
138 | 138 | $vb=$this->visibleProperties; |
139 | - if(isset($vb[$index])){ |
|
140 | - if(\is_array($vb[$index])){ |
|
139 | + if (isset($vb[$index])) { |
|
140 | + if (\is_array($vb[$index])) { |
|
141 | 141 | $this->visibleProperties[$index][]=$field; |
142 | - }else{ |
|
143 | - $this->visibleProperties[$index]=[$vb[$index],$field]; |
|
142 | + } else { |
|
143 | + $this->visibleProperties[$index]=[$vb[$index], $field]; |
|
144 | 144 | } |
145 | - }else{ |
|
145 | + } else { |
|
146 | 146 | return $this->insertField($index, $field); |
147 | 147 | } |
148 | 148 | return $this; |
149 | 149 | } |
150 | 150 | |
151 | - public function addField($field){ |
|
151 | + public function addField($field) { |
|
152 | 152 | $this->visibleProperties[]=$field; |
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | - public function addFields($fields){ |
|
157 | - $this->visibleProperties=\array_merge($this->visibleProperties,$fields); |
|
156 | + public function addFields($fields) { |
|
157 | + $this->visibleProperties=\array_merge($this->visibleProperties, $fields); |
|
158 | 158 | return $this; |
159 | 159 | } |
160 | 160 | |
161 | - public function count(){ |
|
161 | + public function count() { |
|
162 | 162 | return \sizeof($this->properties); |
163 | 163 | } |
164 | 164 | |
165 | - public function visiblePropertiesCount(){ |
|
165 | + public function visiblePropertiesCount() { |
|
166 | 166 | return \sizeof($this->visibleProperties); |
167 | 167 | } |
168 | 168 | |
169 | - public function getProperty($index){ |
|
169 | + public function getProperty($index) { |
|
170 | 170 | return $this->properties[$index]; |
171 | 171 | } |
172 | 172 | |
173 | - public function getFieldName($index){ |
|
173 | + public function getFieldName($index) { |
|
174 | 174 | $property=$this->getProperty($index); |
175 | - if($property instanceof \ReflectionProperty){ |
|
175 | + if ($property instanceof \ReflectionProperty) { |
|
176 | 176 | $result=$property->getName(); |
177 | - }elseif(\is_callable($property)){ |
|
177 | + }elseif (\is_callable($property)) { |
|
178 | 178 | $result=$this->visibleProperties[$index]; |
179 | - }else{ |
|
179 | + } else { |
|
180 | 180 | $result=$property; |
181 | 181 | } |
182 | 182 | return $result; |
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | - protected function showableProperty(\ReflectionProperty $rProperty){ |
|
187 | - return JString::startswith($rProperty->getName(),"_")===false; |
|
186 | + protected function showableProperty(\ReflectionProperty $rProperty) { |
|
187 | + return JString::startswith($rProperty->getName(), "_")===false; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function setInstance($instance) { |
191 | - if(\is_string($instance)){ |
|
191 | + if (\is_string($instance)) { |
|
192 | 192 | $instance=new $instance(); |
193 | 193 | } |
194 | 194 | $this->instance=$instance; |
195 | 195 | $this->properties=[]; |
196 | 196 | $this->reflect=new \ReflectionClass($instance); |
197 | - if(\sizeof($this->visibleProperties)===0){ |
|
197 | + if (\sizeof($this->visibleProperties)===0) { |
|
198 | 198 | $this->properties=$this->getDefaultProperties(); |
199 | - }else{ |
|
200 | - foreach ($this->visibleProperties as $property){ |
|
199 | + } else { |
|
200 | + foreach ($this->visibleProperties as $property) { |
|
201 | 201 | $this->setInstanceProperty($property); |
202 | 202 | } |
203 | 203 | } |
204 | 204 | return $this; |
205 | 205 | } |
206 | 206 | |
207 | - private function setInstanceProperty($property){ |
|
208 | - if(\is_callable($property)){ |
|
207 | + private function setInstanceProperty($property) { |
|
208 | + if (\is_callable($property)) { |
|
209 | 209 | $this->properties[]=$property; |
210 | - }elseif(\is_string($property)){ |
|
211 | - try{ |
|
210 | + }elseif (\is_string($property)) { |
|
211 | + try { |
|
212 | 212 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
213 | 213 | $rProperty=$this->reflect->getProperty($property); |
214 | 214 | $this->properties[]=$rProperty; |
215 | - }catch(\Exception $e){ |
|
215 | + }catch (\Exception $e) { |
|
216 | 216 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
217 | 217 | $this->properties[]=$property; |
218 | 218 | } |
219 | - }elseif(\is_int($property)){ |
|
219 | + }elseif (\is_int($property)) { |
|
220 | 220 | $props=$this->getDefaultProperties(); |
221 | - if(isset($props[$property])) |
|
221 | + if (isset($props[$property])) |
|
222 | 222 | $this->properties[]=$props[$property]; |
223 | 223 | else |
224 | 224 | $this->properties[]=$property; |
225 | - }else{ |
|
225 | + } else { |
|
226 | 226 | $this->properties[]=$property; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - protected function getDefaultProperties(){ |
|
230 | + protected function getDefaultProperties() { |
|
231 | 231 | $result=[]; |
232 | 232 | $properties=$this->reflect->getProperties(); |
233 | - foreach ($properties as $property){ |
|
233 | + foreach ($properties as $property) { |
|
234 | 234 | $showable=$this->showableProperty($property); |
235 | - if($showable!==false){ |
|
235 | + if ($showable!==false) { |
|
236 | 236 | $result[]=$property; |
237 | 237 | } |
238 | 238 | } |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | return $this; |
245 | 245 | } |
246 | 246 | |
247 | - public function setValueFunction($index,$callback){ |
|
247 | + public function setValueFunction($index, $callback) { |
|
248 | 248 | $this->values[$index]=$callback; |
249 | 249 | return $this; |
250 | 250 | } |
251 | 251 | |
252 | - public function setIdentifierFunction($callback){ |
|
252 | + public function setIdentifierFunction($callback) { |
|
253 | 253 | $this->values["identifier"]=$callback; |
254 | 254 | return $this; |
255 | 255 | } |
@@ -262,42 +262,42 @@ discard block |
||
262 | 262 | return $this->properties; |
263 | 263 | } |
264 | 264 | |
265 | - public function getCaption($index){ |
|
266 | - if(isset($this->captions[$index])){ |
|
265 | + public function getCaption($index) { |
|
266 | + if (isset($this->captions[$index])) { |
|
267 | 267 | return $this->captions[$index]; |
268 | 268 | } |
269 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
269 | + if ($this->properties[$index] instanceof \ReflectionProperty) |
|
270 | 270 | return $this->properties[$index]->getName(); |
271 | - elseif(\is_callable($this->properties[$index])) |
|
271 | + elseif (\is_callable($this->properties[$index])) |
|
272 | 272 | return ""; |
273 | 273 | else |
274 | 274 | return $this->properties[$index]; |
275 | 275 | } |
276 | 276 | |
277 | - public function getCaptions(){ |
|
277 | + public function getCaptions() { |
|
278 | 278 | $count=$this->count(); |
279 | - if(isset($this->captions)){ |
|
280 | - $captions= \array_values($this->captions); |
|
279 | + if (isset($this->captions)) { |
|
280 | + $captions=\array_values($this->captions); |
|
281 | 281 | $captionsSize=\sizeof($captions); |
282 | - for($i=$captionsSize;$i<$count;$i++){ |
|
282 | + for ($i=$captionsSize; $i<$count; $i++) { |
|
283 | 283 | $captions[]=""; |
284 | 284 | } |
285 | - }else{ |
|
285 | + } else { |
|
286 | 286 | $captions=[]; |
287 | 287 | $index=0; |
288 | - while($index<$count){ |
|
288 | + while ($index<$count) { |
|
289 | 289 | $captions[]=$this->getCaption($index++); |
290 | 290 | } |
291 | 291 | } |
292 | - if(isset($this->captionCallback) && \is_callable($this->captionCallback)){ |
|
292 | + if (isset($this->captionCallback) && \is_callable($this->captionCallback)) { |
|
293 | 293 | $callback=$this->captionCallback; |
294 | - $callback($captions,$this->instance); |
|
294 | + $callback($captions, $this->instance); |
|
295 | 295 | } |
296 | 296 | return $captions; |
297 | 297 | } |
298 | 298 | |
299 | - public function setCaption($index,$caption){ |
|
300 | - if(isset($this->captions)===false) |
|
299 | + public function setCaption($index, $caption) { |
|
300 | + if (isset($this->captions)===false) |
|
301 | 301 | $this->captions=[]; |
302 | 302 | $this->captions[$index]=$caption; |
303 | 303 | return $this; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @param callable $callback function called after the field compilation |
316 | 316 | * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
317 | 317 | */ |
318 | - public function afterCompile($index,$callback){ |
|
318 | + public function afterCompile($index, $callback) { |
|
319 | 319 | $this->afterCompile[$index]=$callback; |
320 | 320 | return $this; |
321 | 321 | } |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | $this->widgetIdentifier=$identifier; |
24 | 24 | $this->values=[]; |
25 | 25 | $this->afterCompile=[]; |
26 | - if(isset($instance)) |
|
27 | - $this->setInstance($instance); |
|
26 | + if(isset($instance)) { |
|
27 | + $this->setInstance($instance); |
|
28 | + } |
|
28 | 29 | $this->setCaptions($captions); |
29 | 30 | $this->captionCallback=NULL; |
30 | 31 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -62,14 +63,16 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | public function getIdentifier($index=NULL){ |
65 | - if(!isset($index)) |
|
66 | - $index=self::$index; |
|
66 | + if(!isset($index)) { |
|
67 | + $index=self::$index; |
|
68 | + } |
|
67 | 69 | $value=$index; |
68 | 70 | if(isset($this->values["identifier"])){ |
69 | - if(\is_string($this->values["identifier"])) |
|
70 | - $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
71 | - else |
|
72 | - $value=$this->values["identifier"]($index,$this->instance); |
|
71 | + if(\is_string($this->values["identifier"])) { |
|
72 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
73 | + } else { |
|
74 | + $value=$this->values["identifier"]($index,$this->instance); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | return $value; |
75 | 78 | } |
@@ -99,17 +102,17 @@ discard block |
||
99 | 102 | if($property instanceof \ReflectionProperty){ |
100 | 103 | $value=$this->_getPropertyValue($property, $index); |
101 | 104 | $propertyName=$property->getName(); |
102 | - }elseif(\is_array($property)){ |
|
105 | + } elseif(\is_array($property)){ |
|
103 | 106 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
104 | 107 | $value=\implode("", $values); |
105 | - }elseif(\is_string($property)){ |
|
108 | + } elseif(\is_string($property)){ |
|
106 | 109 | $value=$property; |
107 | 110 | if(isset($this->instance->{$property})){ |
108 | 111 | $value=$this->instance->{$property}; |
109 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
112 | + } elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
110 | 113 | $value=JReflection::callMethod($this->instance, $getter, []); |
111 | 114 | } |
112 | - }elseif(\is_callable($property)){ |
|
115 | + } elseif(\is_callable($property)){ |
|
113 | 116 | $value=$property($this->instance); |
114 | 117 | } |
115 | 118 | return $this->_postGetValue($index, $propertyName, $value); |
@@ -118,7 +121,7 @@ discard block |
||
118 | 121 | protected function _postGetValue($index,$propertyName,$value){ |
119 | 122 | if(isset($this->values[$index])){ |
120 | 123 | $value= $this->values[$index]($value,$this->instance,$index); |
121 | - }else{ |
|
124 | + } else{ |
|
122 | 125 | $value=$this->_getDefaultValue($propertyName,$value, $index); |
123 | 126 | } |
124 | 127 | if(isset($this->afterCompile[$index])){ |
@@ -139,10 +142,10 @@ discard block |
||
139 | 142 | if(isset($vb[$index])){ |
140 | 143 | if(\is_array($vb[$index])){ |
141 | 144 | $this->visibleProperties[$index][]=$field; |
142 | - }else{ |
|
145 | + } else{ |
|
143 | 146 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
144 | 147 | } |
145 | - }else{ |
|
148 | + } else{ |
|
146 | 149 | return $this->insertField($index, $field); |
147 | 150 | } |
148 | 151 | return $this; |
@@ -174,9 +177,9 @@ discard block |
||
174 | 177 | $property=$this->getProperty($index); |
175 | 178 | if($property instanceof \ReflectionProperty){ |
176 | 179 | $result=$property->getName(); |
177 | - }elseif(\is_callable($property)){ |
|
180 | + } elseif(\is_callable($property)){ |
|
178 | 181 | $result=$this->visibleProperties[$index]; |
179 | - }else{ |
|
182 | + } else{ |
|
180 | 183 | $result=$property; |
181 | 184 | } |
182 | 185 | return $result; |
@@ -196,7 +199,7 @@ discard block |
||
196 | 199 | $this->reflect=new \ReflectionClass($instance); |
197 | 200 | if(\sizeof($this->visibleProperties)===0){ |
198 | 201 | $this->properties=$this->getDefaultProperties(); |
199 | - }else{ |
|
202 | + } else{ |
|
200 | 203 | foreach ($this->visibleProperties as $property){ |
201 | 204 | $this->setInstanceProperty($property); |
202 | 205 | } |
@@ -207,22 +210,23 @@ discard block |
||
207 | 210 | private function setInstanceProperty($property){ |
208 | 211 | if(\is_callable($property)){ |
209 | 212 | $this->properties[]=$property; |
210 | - }elseif(\is_string($property)){ |
|
213 | + } elseif(\is_string($property)){ |
|
211 | 214 | try{ |
212 | 215 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
213 | 216 | $rProperty=$this->reflect->getProperty($property); |
214 | 217 | $this->properties[]=$rProperty; |
215 | - }catch(\Exception $e){ |
|
218 | + } catch(\Exception $e){ |
|
216 | 219 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
217 | 220 | $this->properties[]=$property; |
218 | 221 | } |
219 | - }elseif(\is_int($property)){ |
|
222 | + } elseif(\is_int($property)){ |
|
220 | 223 | $props=$this->getDefaultProperties(); |
221 | - if(isset($props[$property])) |
|
222 | - $this->properties[]=$props[$property]; |
|
223 | - else |
|
224 | - $this->properties[]=$property; |
|
225 | - }else{ |
|
224 | + if(isset($props[$property])) { |
|
225 | + $this->properties[]=$props[$property]; |
|
226 | + } else { |
|
227 | + $this->properties[]=$property; |
|
228 | + } |
|
229 | + } else{ |
|
226 | 230 | $this->properties[]=$property; |
227 | 231 | } |
228 | 232 | } |
@@ -266,12 +270,13 @@ discard block |
||
266 | 270 | if(isset($this->captions[$index])){ |
267 | 271 | return $this->captions[$index]; |
268 | 272 | } |
269 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
270 | - return $this->properties[$index]->getName(); |
|
271 | - elseif(\is_callable($this->properties[$index])) |
|
272 | - return ""; |
|
273 | - else |
|
274 | - return $this->properties[$index]; |
|
273 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
274 | + return $this->properties[$index]->getName(); |
|
275 | + } elseif(\is_callable($this->properties[$index])) { |
|
276 | + return ""; |
|
277 | + } else { |
|
278 | + return $this->properties[$index]; |
|
279 | + } |
|
275 | 280 | } |
276 | 281 | |
277 | 282 | public function getCaptions(){ |
@@ -282,7 +287,7 @@ discard block |
||
282 | 287 | for($i=$captionsSize;$i<$count;$i++){ |
283 | 288 | $captions[]=""; |
284 | 289 | } |
285 | - }else{ |
|
290 | + } else{ |
|
286 | 291 | $captions=[]; |
287 | 292 | $index=0; |
288 | 293 | while($index<$count){ |
@@ -297,8 +302,9 @@ discard block |
||
297 | 302 | } |
298 | 303 | |
299 | 304 | public function setCaption($index,$caption){ |
300 | - if(isset($this->captions)===false) |
|
301 | - $this->captions=[]; |
|
305 | + if(isset($this->captions)===false) { |
|
306 | + $this->captions=[]; |
|
307 | + } |
|
302 | 308 | $this->captions[$index]=$caption; |
303 | 309 | return $this; |
304 | 310 | } |