@@ -46,8 +46,9 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function setVariations($variations) { |
| 48 | 48 | $this->setProperty("class", $this->_baseClass); |
| 49 | - if (\is_string($variations)) |
|
| 50 | - $variations=\explode(" ", $variations); |
|
| 49 | + if (\is_string($variations)) { |
|
| 50 | + $variations=\explode(" ", $variations); |
|
| 51 | + } |
|
| 51 | 52 | foreach ( $variations as $variation ) { |
| 52 | 53 | $this->addVariation($variation); |
| 53 | 54 | } |
@@ -60,8 +61,9 @@ discard block |
||
| 60 | 61 | } |
| 61 | 62 | |
| 62 | 63 | public function addVariations($variations=array()) { |
| 63 | - if (\is_string($variations)) |
|
| 64 | - $variations=\explode(" ", $variations); |
|
| 64 | + if (\is_string($variations)) { |
|
| 65 | + $variations=\explode(" ", $variations); |
|
| 66 | + } |
|
| 65 | 67 | foreach ( $variations as $variation ) { |
| 66 | 68 | $this->addVariation($variation); |
| 67 | 69 | } |
@@ -69,8 +71,9 @@ discard block |
||
| 69 | 71 | } |
| 70 | 72 | |
| 71 | 73 | public function addStates($states=array()) { |
| 72 | - if (\is_string($states)) |
|
| 73 | - $states=\explode(" ", $states); |
|
| 74 | + if (\is_string($states)) { |
|
| 75 | + $states=\explode(" ", $states); |
|
| 76 | + } |
|
| 74 | 77 | foreach ( $states as $state ) { |
| 75 | 78 | $this->addState($state); |
| 76 | 79 | } |
@@ -79,8 +82,9 @@ discard block |
||
| 79 | 82 | |
| 80 | 83 | public function setStates($states) { |
| 81 | 84 | $this->setProperty("class", $this->_baseClass); |
| 82 | - if (\is_string($states)) |
|
| 83 | - $states=\explode(" ", $states); |
|
| 85 | + if (\is_string($states)) { |
|
| 86 | + $states=\explode(" ", $states); |
|
| 87 | + } |
|
| 84 | 88 | foreach ( $states as $state ) { |
| 85 | 89 | $this->addState($state); |
| 86 | 90 | } |
@@ -112,8 +116,9 @@ discard block |
||
| 112 | 116 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
| 113 | 117 | */ |
| 114 | 118 | public function setDisabled($disable=true) { |
| 115 | - if($disable) |
|
| 116 | - $this->addToProperty("class", "disabled"); |
|
| 119 | + if($disable) { |
|
| 120 | + $this->addToProperty("class", "disabled"); |
|
| 121 | + } |
|
| 117 | 122 | return $this; |
| 118 | 123 | } |
| 119 | 124 | |
@@ -147,14 +152,16 @@ discard block |
||
| 147 | 152 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 148 | 153 | */ |
| 149 | 154 | public function setActive($value=true){ |
| 150 | - if($value) |
|
| 151 | - $this->addToProperty("class", "active"); |
|
| 155 | + if($value) { |
|
| 156 | + $this->addToProperty("class", "active"); |
|
| 157 | + } |
|
| 152 | 158 | return $this; |
| 153 | 159 | } |
| 154 | 160 | |
| 155 | 161 | public function setAttached($value=true){ |
| 156 | - if($value) |
|
| 157 | - $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 162 | + if($value) { |
|
| 163 | + $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 164 | + } |
|
| 158 | 165 | return $this; |
| 159 | 166 | } |
| 160 | 167 | |
@@ -190,10 +197,12 @@ discard block |
||
| 190 | 197 | if(isset($array[$key])){ |
| 191 | 198 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 192 | 199 | $array[$key]=$before.$p.$value.$after; |
| 193 | - }else |
|
| 194 | - $array[$key]=$before.$value.$after; |
|
| 195 | - }else |
|
| 196 | - $array[$key]=$value; |
|
| 200 | + } else { |
|
| 201 | + $array[$key]=$before.$value.$after; |
|
| 202 | + } |
|
| 203 | + } else { |
|
| 204 | + $array[$key]=$value; |
|
| 205 | + } |
|
| 197 | 206 | return $this; |
| 198 | 207 | } |
| 199 | 208 | } |
| 200 | 209 | \ No newline at end of file |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | parent::__construct($identifier, "div","field"); |
| 19 | 19 | $this->content=array(); |
| 20 | 20 | $this->_states=[State::ERROR,State::DISABLED]; |
| 21 | - if(isset($label) && $label!=="") |
|
| 22 | - $this->setLabel($label); |
|
| 21 | + if(isset($label) && $label!=="") { |
|
| 22 | + $this->setLabel($label); |
|
| 23 | + } |
|
| 23 | 24 | $this->setField($field); |
| 24 | 25 | $this->_validation=NULL; |
| 25 | 26 | } |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | * @return mixed |
| 51 | 52 | */ |
| 52 | 53 | public function getLabel(){ |
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 54 | - return $this->content["label"]; |
|
| 54 | + if(\array_key_exists("label", $this->content)) { |
|
| 55 | + return $this->content["label"]; |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | /** |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | 63 | if(\is_array($rules)){ |
| 64 | 64 | $element->addRules($rules); |
| 65 | - } |
|
| 66 | - else{ |
|
| 65 | + } else{ |
|
| 67 | 66 | $element->addRule($rules); |
| 68 | 67 | } |
| 69 | 68 | unset($attributes["rules"]); |
@@ -123,8 +122,9 @@ discard block |
||
| 123 | 122 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 124 | 123 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 125 | 124 | $header=new HtmlHeader($id,$niveau,$value); |
| 126 | - if(isset($icon)) |
|
| 127 | - $header->asIcon($icon, $value); |
|
| 125 | + if(isset($icon)) { |
|
| 126 | + $header->asIcon($icon, $value); |
|
| 127 | + } |
|
| 128 | 128 | return $header; |
| 129 | 129 | }, $index,$attributes,"header"); |
| 130 | 130 | } |
@@ -132,7 +132,9 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 134 | 134 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 136 | + $image->setCircular(); |
|
| 137 | + } |
|
| 136 | 138 | return $image; |
| 137 | 139 | }); |
| 138 | 140 | return $this; |
@@ -221,14 +223,14 @@ discard block |
||
| 221 | 223 | $i=0; |
| 222 | 224 | if(JArray::isAssociative($types)){ |
| 223 | 225 | foreach ($types as $type=>$attributes){ |
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 226 | + if(\is_int($type)) { |
|
| 227 | + $this->fieldAs($i++,$attributes,[]); |
|
| 228 | + } else{ |
|
| 227 | 229 | $type=preg_replace('/\d/', '', $type ); |
| 228 | 230 | $this->fieldAs($i++,$type,$attributes); |
| 229 | 231 | } |
| 230 | 232 | } |
| 231 | - }else{ |
|
| 233 | + } else{ |
|
| 232 | 234 | foreach ($types as $type){ |
| 233 | 235 | $this->fieldAs($i++,$type); |
| 234 | 236 | } |
@@ -240,7 +242,7 @@ discard block |
||
| 240 | 242 | if(\method_exists($this, $method)){ |
| 241 | 243 | if(!\is_array($attributes)){ |
| 242 | 244 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 245 | + } else{ |
|
| 244 | 246 | \array_unshift($attributes, $index); |
| 245 | 247 | } |
| 246 | 248 | \call_user_func_array([$this,$method], $attributes); |