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