@@ -82,8 +82,9 @@ discard block |
||
82 | 82 | if (isset($this->content[$index]) === false) { |
83 | 83 | $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
84 | 84 | ->getIdentifier()); |
85 | - } else |
|
86 | - $this->content[$index]->setContent($content); |
|
85 | + } else { |
|
86 | + $this->content[$index]->setContent($content); |
|
87 | + } |
|
87 | 88 | } |
88 | 89 | return $this; |
89 | 90 | } |
@@ -277,15 +278,17 @@ discard block |
||
277 | 278 | * @see BaseHtml::run() |
278 | 279 | */ |
279 | 280 | public function run(JsUtils $js) { |
280 | - if (isset($this->_bsComponent) === false) |
|
281 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
281 | + if (isset($this->_bsComponent) === false) { |
|
282 | + $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
283 | + } |
|
282 | 284 | $this->addEventsOnRun($js); |
283 | 285 | return $this->_bsComponent; |
284 | 286 | } |
285 | 287 | |
286 | 288 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
287 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
288 | - $this->activate(0); |
|
289 | + if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) { |
|
290 | + $this->activate(0); |
|
291 | + } |
|
289 | 292 | return parent::compile($js, $view); |
290 | 293 | } |
291 | 294 | } |
@@ -141,8 +141,9 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public function addInput($name) { |
144 | - if (! isset($name)) |
|
145 | - $name = "input-" . $this->identifier; |
|
144 | + if (! isset($name)) { |
|
145 | + $name = "input-" . $this->identifier; |
|
146 | + } |
|
146 | 147 | $this->setAction("activate"); |
147 | 148 | $this->input = new HtmlInput($name, "hidden"); |
148 | 149 | $this->input->setIdentifier("input-" . $this->identifier); |
@@ -293,24 +294,27 @@ discard block |
||
293 | 294 | |
294 | 295 | public function asButton($floating = false) { |
295 | 296 | $this->removeArrow(); |
296 | - if ($floating) |
|
297 | - $this->addToProperty("class", "floating"); |
|
297 | + if ($floating) { |
|
298 | + $this->addToProperty("class", "floating"); |
|
299 | + } |
|
298 | 300 | $this->removePropertyValue("class", "selection"); |
299 | 301 | return $this->addToProperty("class", "button"); |
300 | 302 | } |
301 | 303 | |
302 | 304 | public function asSelect($name = NULL, $multiple = false, $selection = true) { |
303 | 305 | $this->_multiple = $multiple; |
304 | - if (isset($name)) |
|
305 | - $this->addInput($name); |
|
306 | + if (isset($name)) { |
|
307 | + $this->addInput($name); |
|
308 | + } |
|
306 | 309 | if ($multiple) { |
307 | 310 | $this->addToProperty("class", "multiple"); |
308 | 311 | } |
309 | 312 | if ($selection) { |
310 | - if ($this->propertyContains("class", "button") === false) |
|
311 | - $this->addToPropertyCtrl("class", "selection", array( |
|
313 | + if ($this->propertyContains("class", "button") === false) { |
|
314 | + $this->addToPropertyCtrl("class", "selection", array( |
|
312 | 315 | "selection" |
313 | 316 | )); |
317 | + } |
|
314 | 318 | } |
315 | 319 | return $this; |
316 | 320 | } |
@@ -322,8 +326,9 @@ discard block |
||
322 | 326 | |
323 | 327 | public function setSelect($name = NULL, $multiple = false) { |
324 | 328 | $this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
325 | - if (! isset($name)) |
|
326 | - $name = "select-" . $this->identifier; |
|
329 | + if (! isset($name)) { |
|
330 | + $name = "select-" . $this->identifier; |
|
331 | + } |
|
327 | 332 | $this->input = null; |
328 | 333 | if ($multiple) { |
329 | 334 | $this->setProperty("multiple", true); |
@@ -368,8 +373,9 @@ discard block |
||
368 | 373 | $this->setProperty("value", $value); |
369 | 374 | } |
370 | 375 | $textElement = $this->getElementById("text-" . $this->identifier, $this->content); |
371 | - if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) |
|
372 | - $textElement->setContent($value); |
|
376 | + if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) { |
|
377 | + $textElement->setContent($value); |
|
378 | + } |
|
373 | 379 | return $this; |
374 | 380 | } |
375 | 381 |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | public function asIcon($icon, $title, $subHeader = NULL) { |
27 | 27 | $header = new HtmlHeader("header-" . $this->identifier); |
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
30 | - $header->setInverted(); |
|
29 | + if ($this->_inverted === false) { |
|
30 | + $header->setInverted(); |
|
31 | + } |
|
31 | 32 | return $this->setContent($header); |
32 | 33 | } |
33 | 34 | |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | } |
52 | 53 | |
53 | 54 | public function jsShow() { |
54 | - if (isset($this->_container)) |
|
55 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
55 | + if (isset($this->_container)) { |
|
56 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | public function setBlurring() { |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function compile($internal = false) { |
48 | - if ($internal === false && $this->autoCompile === true) |
|
49 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
48 | + if ($internal === false && $this->autoCompile === true) { |
|
49 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
50 | + } |
|
50 | 51 | foreach ($this->components as $component) { |
51 | 52 | $component->compile(); |
52 | 53 | } |
@@ -69,9 +70,10 @@ discard block |
||
69 | 70 | $this->components[] = $component; |
70 | 71 | } |
71 | 72 | } |
72 | - if (isset($params)) |
|
73 | - if (\is_array($params)) |
|
73 | + if (isset($params)) { |
|
74 | + if (\is_array($params)) |
|
74 | 75 | $component->setParams($params); |
76 | + } |
|
75 | 77 | return $component; |
76 | 78 | } |
77 | 79 |
@@ -85,10 +85,11 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function setDismissable($dismiss = true) { |
88 | - if ($dismiss === true) |
|
89 | - $this->close = new HtmlIcon("close-" . $this->identifier, "close"); |
|
90 | - else |
|
91 | - $this->close = NULL; |
|
88 | + if ($dismiss === true) { |
|
89 | + $this->close = new HtmlIcon("close-" . $this->identifier, "close"); |
|
90 | + } else { |
|
91 | + $this->close = NULL; |
|
92 | + } |
|
92 | 93 | return $this; |
93 | 94 | } |
94 | 95 | |
@@ -139,7 +140,8 @@ discard block |
||
139 | 140 | public function setMessage($message) { |
140 | 141 | if (\is_array($this->content)) { |
141 | 142 | $this->content[\sizeof($this->content) - 1] = $message; |
142 | - } else |
|
143 | - $this->setContent($message); |
|
143 | + } else { |
|
144 | + $this->setContent($message); |
|
145 | + } |
|
144 | 146 | } |
145 | 147 | } |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | $field = new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
16 | 16 | $field->setProperty("name", $name); |
17 | 17 | $this->setField($field); |
18 | - if (isset($label)) |
|
19 | - $this->setLabel($label, $value); |
|
18 | + if (isset($label)) { |
|
19 | + $this->setLabel($label, $value); |
|
20 | + } |
|
20 | 21 | $this->setLibraryId($identifier); |
21 | 22 | } |
22 | 23 | |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | $labelO->setContent($label); |
41 | 42 | $labelO->setProperty("for", $this->getField() |
42 | 43 | ->getIdentifier()); |
43 | - if (isset($value)) |
|
44 | - $labelO->setProperty("data-value", $value); |
|
44 | + if (isset($value)) { |
|
45 | + $labelO->setProperty("data-value", $value); |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | $this->content["label"] = $labelO; |
47 | 49 | } |
@@ -56,8 +58,9 @@ discard block |
||
56 | 58 | * @return mixed |
57 | 59 | */ |
58 | 60 | public function getLabel() { |
59 | - if (\array_key_exists("label", $this->content)) |
|
60 | - return $this->content["label"]; |
|
61 | + if (\array_key_exists("label", $this->content)) { |
|
62 | + return $this->content["label"]; |
|
63 | + } |
|
61 | 64 | } |
62 | 65 | |
63 | 66 | /** |
@@ -138,8 +141,9 @@ discard block |
||
138 | 141 | } |
139 | 142 | |
140 | 143 | public function run(JsUtils $js) { |
141 | - if (! isset($this->_bsComponent)) |
|
142 | - $this->_bsComponent = $js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
144 | + if (! isset($this->_bsComponent)) { |
|
145 | + $this->_bsComponent = $js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
146 | + } |
|
143 | 147 | return parent::run($js); |
144 | 148 | } |
145 | 149 | } |
@@ -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 | } |
@@ -123,9 +126,9 @@ discard block |
||
123 | 126 | $propertyName = $property->getName(); |
124 | 127 | } elseif (\is_callable($property) && array_search($property, [ |
125 | 128 | "system" |
126 | - ]) === false) |
|
127 | - $value = $property($this->instance); |
|
128 | - elseif (\is_array($property)) { |
|
129 | + ]) === false) { |
|
130 | + $value = $property($this->instance); |
|
131 | + } elseif (\is_array($property)) { |
|
129 | 132 | $values = \array_map(function ($v) use ($index) { |
130 | 133 | return $this->_getValue($v, $index); |
131 | 134 | }, $property); |
@@ -279,10 +282,11 @@ discard block |
||
279 | 282 | } |
280 | 283 | } elseif (\is_int($property)) { |
281 | 284 | $props = $this->getDefaultProperties(); |
282 | - if (isset($props[$property])) |
|
283 | - $this->properties[] = $props[$property]; |
|
284 | - else |
|
285 | - $this->properties[] = $property; |
|
285 | + if (isset($props[$property])) { |
|
286 | + $this->properties[] = $props[$property]; |
|
287 | + } else { |
|
288 | + $this->properties[] = $property; |
|
289 | + } |
|
286 | 290 | } else { |
287 | 291 | $this->properties[] = $property; |
288 | 292 | } |
@@ -327,12 +331,13 @@ discard block |
||
327 | 331 | if (isset($this->captions[$index])) { |
328 | 332 | return $this->captions[$index]; |
329 | 333 | } |
330 | - if ($this->properties[$index] instanceof \ReflectionProperty) |
|
331 | - return $this->properties[$index]->getName(); |
|
332 | - elseif (\is_callable($this->properties[$index])) |
|
333 | - return ""; |
|
334 | - else |
|
335 | - 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 | + } |
|
336 | 341 | } |
337 | 342 | |
338 | 343 | public function getCaptions() { |
@@ -365,8 +370,9 @@ discard block |
||
365 | 370 | } |
366 | 371 | |
367 | 372 | public function setCaption($index, $caption) { |
368 | - if (isset($this->captions) === false) |
|
369 | - $this->captions = []; |
|
373 | + if (isset($this->captions) === false) { |
|
374 | + $this->captions = []; |
|
375 | + } |
|
370 | 376 | $this->captions[$index] = $caption; |
371 | 377 | return $this; |
372 | 378 | } |
@@ -81,16 +81,19 @@ discard block |
||
81 | 81 | "stopPropagation" => true |
82 | 82 | ]); |
83 | 83 | } |
84 | - if (\is_array($this->_deleteBehavior)) |
|
85 | - $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
86 | - if (\is_array($this->_editBehavior)) |
|
87 | - $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
84 | + if (\is_array($this->_deleteBehavior)) { |
|
85 | + $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
86 | + } |
|
87 | + if (\is_array($this->_editBehavior)) { |
|
88 | + $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
89 | + } |
|
88 | 90 | if (\is_array($this->_displayBehavior)) { |
89 | 91 | $this->_generateBehavior("display", $this->_displayBehavior, $js); |
90 | 92 | } |
91 | 93 | parent::run($js); |
92 | - if (isset($this->_pagination)) |
|
93 | - $this->_associatePaginationBehavior($js, $offset); |
|
94 | + if (isset($this->_pagination)) { |
|
95 | + $this->_associatePaginationBehavior($js, $offset); |
|
96 | + } |
|
94 | 97 | $this->_associateSearchFieldBehavior($js, $offset); |
95 | 98 | } |
96 | 99 | |
@@ -139,8 +142,9 @@ discard block |
||
139 | 142 | $table->setRowCount(0, \sizeof($captions)); |
140 | 143 | $this->_generateHeader($table, $captions); |
141 | 144 | |
142 | - if (isset($this->_compileParts)) |
|
143 | - $table->setCompileParts($this->_compileParts); |
|
145 | + if (isset($this->_compileParts)) { |
|
146 | + $table->setCompileParts($this->_compileParts); |
|
147 | + } |
|
144 | 148 | |
145 | 149 | $this->_generateContent($table); |
146 | 150 | |
@@ -175,8 +179,9 @@ discard block |
||
175 | 179 | } |
176 | 180 | |
177 | 181 | protected function _applyStyleAttributes($table) { |
178 | - if (isset($this->_hiddenColumns)) |
|
179 | - $this->_hideColumns(); |
|
182 | + if (isset($this->_hiddenColumns)) { |
|
183 | + $this->_hideColumns(); |
|
184 | + } |
|
180 | 185 | if (isset($this->_colWidths)) { |
181 | 186 | foreach ($this->_colWidths as $colIndex => $width) { |
182 | 187 | $table->setColWidth($colIndex, $width); |
@@ -285,8 +290,9 @@ discard block |
||
285 | 290 | $field = $ck->getField(); |
286 | 291 | $field->setProperty("value", $dataAjax); |
287 | 292 | $field->setProperty("name", "selection[]"); |
288 | - if (isset($checkedClass)) |
|
289 | - $field->setClass($checkedClass); |
|
293 | + if (isset($checkedClass)) { |
|
294 | + $field->setClass($checkedClass); |
|
295 | + } |
|
290 | 296 | \array_unshift($values, $ck); |
291 | 297 | } |
292 | 298 | $result = $table->newRow(); |
@@ -303,8 +309,9 @@ discard block |
||
303 | 309 | |
304 | 310 | protected function _generatePagination($table) { |
305 | 311 | if (isset($this->_toolbar)) { |
306 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
307 | - $this->_toolbar->setFloated("left"); |
|
312 | + if ($this->_toolbarPosition == PositionInTable::FOOTER) { |
|
313 | + $this->_toolbar->setFloated("left"); |
|
314 | + } |
|
308 | 315 | } |
309 | 316 | $footer = $table->getFooter(); |
310 | 317 | $footer->mergeCol(); |
@@ -344,8 +351,9 @@ discard block |
||
344 | 351 | |
345 | 352 | protected function _getFieldName($index) { |
346 | 353 | $fieldName = parent::_getFieldName($index); |
347 | - if (\is_object($fieldName)) |
|
348 | - $fieldName = "field-" . $index; |
|
354 | + if (\is_object($fieldName)) { |
|
355 | + $fieldName = "field-" . $index; |
|
356 | + } |
|
349 | 357 | return $fieldName . "[]"; |
350 | 358 | } |
351 | 359 | |
@@ -522,8 +530,9 @@ discard block |
||
522 | 530 | |
523 | 531 | protected function getTargetSelector($op) { |
524 | 532 | $result = $this->_targetSelector; |
525 | - if (! isset($result[$op])) |
|
526 | - $result = "#" . $this->identifier; |
|
533 | + if (! isset($result[$op])) { |
|
534 | + $result = "#" . $this->identifier; |
|
535 | + } |
|
527 | 536 | return $result[$op]; |
528 | 537 | } |
529 | 538 | |
@@ -546,8 +555,9 @@ discard block |
||
546 | 555 | } |
547 | 556 | |
548 | 557 | public function getRefreshSelector() { |
549 | - if (isset($this->_refreshSelector)) |
|
550 | - return $this->_refreshSelector; |
|
558 | + if (isset($this->_refreshSelector)) { |
|
559 | + return $this->_refreshSelector; |
|
560 | + } |
|
551 | 561 | return "#" . $this->identifier . " tbody"; |
552 | 562 | } |
553 | 563 | |
@@ -568,8 +578,9 @@ discard block |
||
568 | 578 | */ |
569 | 579 | public function show($modelInstance) { |
570 | 580 | if (\is_array($modelInstance)) { |
571 | - if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
572 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
581 | + if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
582 | + $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
583 | + } |
|
573 | 584 | } |
574 | 585 | $this->_modelInstance = $modelInstance; |
575 | 586 | } |
@@ -611,8 +622,9 @@ discard block |
||
611 | 622 | } |
612 | 623 | |
613 | 624 | public function hideColumn($colIndex) { |
614 | - if (! \is_array($this->_hiddenColumns)) |
|
615 | - $this->_hiddenColumns = []; |
|
625 | + if (! \is_array($this->_hiddenColumns)) { |
|
626 | + $this->_hiddenColumns = []; |
|
627 | + } |
|
616 | 628 | $this->_hiddenColumns[] = $colIndex; |
617 | 629 | return $this; |
618 | 630 | } |
@@ -12,21 +12,24 @@ discard block |
||
12 | 12 | return $array[$key]; |
13 | 13 | } |
14 | 14 | $values = array_values($array); |
15 | - if ($pos < sizeof($values)) |
|
16 | - return $values[$pos]; |
|
15 | + if ($pos < sizeof($values)) { |
|
16 | + return $values[$pos]; |
|
17 | + } |
|
17 | 18 | } |
18 | 19 | |
19 | 20 | public static function getConditionalValue($array, $key, $condition) { |
20 | 21 | $result = NULL; |
21 | 22 | if (array_key_exists($key, $array)) { |
22 | 23 | $result = $array[$key]; |
23 | - if ($condition($result) === true) |
|
24 | - return $result; |
|
24 | + if ($condition($result) === true) { |
|
25 | + return $result; |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | $values = array_values($array); |
27 | 29 | foreach ($values as $val) { |
28 | - if ($condition($val) === true) |
|
29 | - return $val; |
|
30 | + if ($condition($val) === true) { |
|
31 | + return $val; |
|
32 | + } |
|
30 | 33 | } |
31 | 34 | return $result; |
32 | 35 | } |
@@ -34,8 +37,9 @@ discard block |
||
34 | 37 | public static function getDefaultValue($array, $key, $default = NULL) { |
35 | 38 | if (array_key_exists($key, $array)) { |
36 | 39 | return $array[$key]; |
37 | - } else |
|
38 | - return $default; |
|
40 | + } else { |
|
41 | + return $default; |
|
42 | + } |
|
39 | 43 | } |
40 | 44 | |
41 | 45 | public static function implode($glue, $pieces) { |
@@ -116,12 +120,12 @@ discard block |
||
116 | 120 | } |
117 | 121 | |
118 | 122 | private static function callFunction($object, $callback) { |
119 | - if (\is_string($callback)) |
|
120 | - return \call_user_func(array( |
|
123 | + if (\is_string($callback)) { |
|
124 | + return \call_user_func(array( |
|
121 | 125 | $object, |
122 | 126 | $callback |
123 | 127 | ), []); |
124 | - else if (\is_callable($callback)) { |
|
128 | + } else if (\is_callable($callback)) { |
|
125 | 129 | return $callback($object); |
126 | 130 | } |
127 | 131 | } |