@@ -35,8 +35,9 @@ discard block |
||
| 35 | 35 | $this->widgetIdentifier = $identifier; |
| 36 | 36 | $this->values = []; |
| 37 | 37 | $this->afterCompile = []; |
| 38 | - if (isset($instance)) |
|
| 39 | - $this->setInstance($instance); |
|
| 38 | + if (isset($instance)) { |
|
| 39 | + $this->setInstance($instance); |
|
| 40 | + } |
|
| 40 | 41 | $this->setCaptions($captions); |
| 41 | 42 | $this->captionCallback = NULL; |
| 42 | 43 | $this->defaultValueFunction = function ($name, $value) { |
@@ -86,14 +87,16 @@ discard block |
||
| 86 | 87 | } |
| 87 | 88 | |
| 88 | 89 | public function getIdentifier($index = NULL) { |
| 89 | - if (! isset($index)) |
|
| 90 | - $index = self::$index; |
|
| 90 | + if (! isset($index)) { |
|
| 91 | + $index = self::$index; |
|
| 92 | + } |
|
| 91 | 93 | $value = $index; |
| 92 | 94 | if (isset($this->values["identifier"])) { |
| 93 | - if (\is_string($this->values["identifier"])) |
|
| 94 | - $value = JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
| 95 | - else |
|
| 96 | - $value = $this->values["identifier"]($index, $this->instance); |
|
| 95 | + if (\is_string($this->values["identifier"])) { |
|
| 96 | + $value = JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
| 97 | + } else { |
|
| 98 | + $value = $this->values["identifier"]($index, $this->instance); |
|
| 99 | + } |
|
| 97 | 100 | } |
| 98 | 101 | return $value; |
| 99 | 102 | } |
@@ -124,9 +127,8 @@ discard block |
||
| 124 | 127 | } elseif (\is_callable($property) && \array_search($property, ['system','date']) === false){ |
| 125 | 128 | try{ |
| 126 | 129 | $value = $property($this->instance); |
| 127 | - }catch(\Error $e){} |
|
| 128 | - } |
|
| 129 | - elseif (\is_array($property)) { |
|
| 130 | + } catch(\Error $e){} |
|
| 131 | + } elseif (\is_array($property)) { |
|
| 130 | 132 | $values = \array_map(function ($v) use ($index) { |
| 131 | 133 | return $this->_getValue($v, $index); |
| 132 | 134 | }, $property); |
@@ -280,10 +282,11 @@ discard block |
||
| 280 | 282 | } |
| 281 | 283 | } elseif (\is_int($property)) { |
| 282 | 284 | $props = $this->getDefaultProperties(); |
| 283 | - if (isset($props[$property])) |
|
| 284 | - $this->properties[] = $props[$property]; |
|
| 285 | - else |
|
| 286 | - $this->properties[] = $property; |
|
| 285 | + if (isset($props[$property])) { |
|
| 286 | + $this->properties[] = $props[$property]; |
|
| 287 | + } else { |
|
| 288 | + $this->properties[] = $property; |
|
| 289 | + } |
|
| 287 | 290 | } else { |
| 288 | 291 | $this->properties[] = $property; |
| 289 | 292 | } |
@@ -328,12 +331,13 @@ discard block |
||
| 328 | 331 | if (isset($this->captions[$index])) { |
| 329 | 332 | return $this->captions[$index]; |
| 330 | 333 | } |
| 331 | - if ($this->properties[$index] instanceof \ReflectionProperty) |
|
| 332 | - return $this->properties[$index]->getName(); |
|
| 333 | - elseif (\is_callable($this->properties[$index])) |
|
| 334 | - return ""; |
|
| 335 | - else |
|
| 336 | - return $this->properties[$index]; |
|
| 334 | + if ($this->properties[$index] instanceof \ReflectionProperty) { |
|
| 335 | + return $this->properties[$index]->getName(); |
|
| 336 | + } elseif (\is_callable($this->properties[$index])) { |
|
| 337 | + return ""; |
|
| 338 | + } else { |
|
| 339 | + return $this->properties[$index]; |
|
| 340 | + } |
|
| 337 | 341 | } |
| 338 | 342 | |
| 339 | 343 | public function getCaptions() { |
@@ -366,8 +370,9 @@ discard block |
||
| 366 | 370 | } |
| 367 | 371 | |
| 368 | 372 | public function setCaption($index, $caption) { |
| 369 | - if (isset($this->captions) === false) |
|
| 370 | - $this->captions = []; |
|
| 373 | + if (isset($this->captions) === false) { |
|
| 374 | + $this->captions = []; |
|
| 375 | + } |
|
| 371 | 376 | $this->captions[$index] = $caption; |
| 372 | 377 | return $this; |
| 373 | 378 | } |