@@ -62,12 +62,12 @@ |
||
62 | 62 | $this->customRules[]=$type; |
63 | 63 | $this->hasCustomRules=true; |
64 | 64 | } |
65 | - }elseif(\is_array($type)){ |
|
65 | + } elseif(\is_array($type)){ |
|
66 | 66 | $value=JArray::getValue($type, "value", 2); |
67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
68 | 68 | $type=JArray::getValue($type, "type", 0); |
69 | 69 | $rule=new Rule($type,$prompt,$value); |
70 | - }else { |
|
70 | + } else { |
|
71 | 71 | $rule = new Rule($type, $prompt, $value); |
72 | 72 | } |
73 | 73 | $this->rules[]=$rule; |
@@ -35,17 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | public function addContent($content, $before = false) { |
37 | 37 | if (! \is_array($this->content)) { |
38 | - if (isset($this->content)) |
|
39 | - $this->content = array( |
|
38 | + if (isset($this->content)) { |
|
39 | + $this->content = array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | - else |
|
43 | - $this->content = array(); |
|
42 | + } else { |
|
43 | + $this->content = array(); |
|
44 | + } |
|
45 | + } |
|
46 | + if ($before) { |
|
47 | + \array_unshift($this->content, $content); |
|
48 | + } else { |
|
49 | + $this->content[] = $content; |
|
44 | 50 | } |
45 | - if ($before) |
|
46 | - \array_unshift($this->content, $content); |
|
47 | - else |
|
48 | - $this->content[] = $content; |
|
49 | 51 | return $this; |
50 | 52 | } |
51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
108 | 110 | * @return HtmlDoubleElement |
109 | 111 | */ |
110 | 112 | public function asLink($href = NULL, $target = NULL) { |
111 | - if (isset($href)) |
|
112 | - $this->setProperty("href", $href); |
|
113 | - if (isset($target)) |
|
114 | - $this->setProperty("target", $target); |
|
113 | + if (isset($href)) { |
|
114 | + $this->setProperty("href", $href); |
|
115 | + } |
|
116 | + if (isset($target)) { |
|
117 | + $this->setProperty("target", $target); |
|
118 | + } |
|
115 | 119 | return $this->setTagName("a"); |
116 | 120 | } |
117 | 121 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else{ |
|
75 | 75 | $separators[]=$count; |
76 | 76 | for($i=0;$i<$size;$i++){ |
77 | 77 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -85,18 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
88 | + if(isset($headers[$sepFirst+1])) { |
|
89 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | + } |
|
90 | 91 | if(isset($wrappers[$sepFirst+1])){ |
91 | 92 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 93 | } |
93 | 94 | $count=\count($values); |
94 | 95 | if($count===1){ |
95 | 96 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
97 | + } elseif($count>1){ |
|
97 | 98 | $added=$form->addFields($values); |
98 | - }else |
|
99 | - return; |
|
99 | + } else { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | if(isset($wrapper)){ |
101 | 103 | $added->wrap($wrapper[0],$wrapper[1]); |
102 | 104 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | $actionO = $action; |
67 | 67 | if (\is_object($action) === false) { |
68 | 68 | $actionO = new HtmlButton("action-" . $this->identifier, $action); |
69 | - if (isset($icon)) |
|
70 | - $actionO->addIcon($icon, true, $labeled); |
|
69 | + if (isset($icon)) { |
|
70 | + $actionO->addIcon($icon, true, $labeled); |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
73 | 74 | return $actionO; |
@@ -66,8 +66,9 @@ |
||
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
69 | + if (! \is_array($this->_contentSeparator)) { |
|
70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | + } |
|
71 | 72 | $this->_contentSeparator[$index] = $divider; |
72 | 73 | } else { |
73 | 74 | $this->_contentSeparator = $divider; |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | $class = 'cancel'; |
86 | 86 | } |
87 | 87 | $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
88 | - if ($class !== '') |
|
89 | - $action->addToProperty('class', $class); |
|
88 | + if ($class !== '') { |
|
89 | + $action->addToProperty('class', $class); |
|
90 | + } |
|
90 | 91 | } |
91 | 92 | return $this->addElementInPart($action, 'actions'); |
92 | 93 | } |
@@ -214,8 +215,9 @@ discard block |
||
214 | 215 | * @see BaseHtml::run() |
215 | 216 | */ |
216 | 217 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
218 | + if (isset($this->_bsComponent) === false) { |
|
219 | + $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
220 | + } |
|
219 | 221 | $this->addEventsOnRun($js); |
220 | 222 | return $this->_bsComponent; |
221 | 223 | } |
@@ -68,15 +68,17 @@ discard block |
||
68 | 68 | private function getFieldButton($caption,$visibleHover=true,$icon=null){ |
69 | 69 | $id=$this->_instanceViewer->getIdentifier(); |
70 | 70 | $bt= new HtmlButton($this->cleanIdentifier($icon??$caption).'-'.$id,$caption); |
71 | - if($visibleHover) |
|
72 | - $this->_visibleOver($bt); |
|
71 | + if($visibleHover) { |
|
72 | + $this->_visibleOver($bt); |
|
73 | + } |
|
73 | 74 | return $bt; |
74 | 75 | } |
75 | 76 | |
76 | 77 | private function getFieldButtons($buttons,$visibleHover=true){ |
77 | 78 | $bts=new HtmlButtonGroups("",$buttons); |
78 | - if($visibleHover) |
|
79 | - $this->_visibleOver($bts); |
|
79 | + if($visibleHover) { |
|
80 | + $this->_visibleOver($bts); |
|
81 | + } |
|
80 | 82 | return $bts; |
81 | 83 | } |
82 | 84 | |
@@ -93,8 +95,9 @@ discard block |
||
93 | 95 | return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
94 | 96 | $button=new HtmlButton($id,$value,$cssStyle); |
95 | 97 | $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
96 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
97 | - $this->_visibleOver($button); |
|
98 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) { |
|
99 | + $this->_visibleOver($button); |
|
100 | + } |
|
98 | 101 | return $button; |
99 | 102 | }, $index,$attributes); |
100 | 103 | } |
@@ -165,8 +168,9 @@ discard block |
||
165 | 168 | private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
166 | 169 | $bt=$this->getFieldButton("",$visibleHover,$icon); |
167 | 170 | $bt->asIcon($icon); |
168 | - if(isset($class)) |
|
169 | - $bt->addClass($class); |
|
171 | + if(isset($class)) { |
|
172 | + $bt->addClass($class); |
|
173 | + } |
|
170 | 174 | return $bt; |
171 | 175 | } |
172 | 176 |
@@ -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); |
@@ -264,7 +266,7 @@ discard block |
||
264 | 266 | $this->setInstanceProperty($property); |
265 | 267 | } |
266 | 268 | } |
267 | - }catch (\Throwable $th){ |
|
269 | + } catch (\Throwable $th){ |
|
268 | 270 | |
269 | 271 | } |
270 | 272 | return $this; |
@@ -284,10 +286,11 @@ discard block |
||
284 | 286 | } |
285 | 287 | } elseif (\is_int($property)) { |
286 | 288 | $props = $this->getDefaultProperties(); |
287 | - if (isset($props[$property])) |
|
288 | - $this->properties[] = $props[$property]; |
|
289 | - else |
|
290 | - $this->properties[] = $property; |
|
289 | + if (isset($props[$property])) { |
|
290 | + $this->properties[] = $props[$property]; |
|
291 | + } else { |
|
292 | + $this->properties[] = $property; |
|
293 | + } |
|
291 | 294 | } else { |
292 | 295 | $this->properties[] = $property; |
293 | 296 | } |
@@ -332,12 +335,13 @@ discard block |
||
332 | 335 | if (isset($this->captions[$index])) { |
333 | 336 | return $this->captions[$index]; |
334 | 337 | } |
335 | - if ($this->properties[$index] instanceof \ReflectionProperty) |
|
336 | - return $this->properties[$index]->getName(); |
|
337 | - elseif (\is_callable($this->properties[$index])) |
|
338 | - return ""; |
|
339 | - else |
|
340 | - return $this->properties[$index]; |
|
338 | + if ($this->properties[$index] instanceof \ReflectionProperty) { |
|
339 | + return $this->properties[$index]->getName(); |
|
340 | + } elseif (\is_callable($this->properties[$index])) { |
|
341 | + return ""; |
|
342 | + } else { |
|
343 | + return $this->properties[$index]; |
|
344 | + } |
|
341 | 345 | } |
342 | 346 | |
343 | 347 | public function getCaptions() { |
@@ -370,8 +374,9 @@ discard block |
||
370 | 374 | } |
371 | 375 | |
372 | 376 | public function setCaption($index, $caption) { |
373 | - if (isset($this->captions) === false) |
|
374 | - $this->captions = []; |
|
377 | + if (isset($this->captions) === false) { |
|
378 | + $this->captions = []; |
|
379 | + } |
|
375 | 380 | $this->captions[$index] = $caption; |
376 | 381 | return $this; |
377 | 382 | } |
@@ -27,9 +27,9 @@ |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | public static function getConstantValues($postFix = "", $prefixBefore = false) { |
30 | - if ($postFix == "") |
|
31 | - return \array_values(self::getConstants()); |
|
32 | - else { |
|
30 | + if ($postFix == "") { |
|
31 | + return \array_values(self::getConstants()); |
|
32 | + } else { |
|
33 | 33 | if ($prefixBefore === false) { |
34 | 34 | return \array_map(function ($elem) use ($postFix) { |
35 | 35 | return $elem . " " . $postFix; |