@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | * @param mixed $view |
| 20 | 20 | */ |
| 21 | 21 | protected function _compileLibrary(BaseGui $library, &$view = NULL) { |
| 22 | - if (isset($view)) |
|
| 23 | - $library->compileHtml($this, $view); |
|
| 22 | + if (isset($view)) { |
|
| 23 | + $library->compileHtml($this, $view); |
|
| 24 | + } |
|
| 24 | 25 | if ($library->isAutoCompile()) { |
| 25 | 26 | $library->compile(true); |
| 26 | 27 | } |
@@ -39,8 +40,9 @@ discard block |
||
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | protected function minify($input) { |
| 42 | - if (trim($input) === "") |
|
| 43 | - return $input; |
|
| 43 | + if (trim($input) === "") { |
|
| 44 | + return $input; |
|
| 45 | + } |
|
| 44 | 46 | $input = preg_replace(array( |
| 45 | 47 | // Remove comment(s) |
| 46 | 48 | '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#', |
@@ -59,10 +59,12 @@ discard block |
||
| 59 | 59 | #[\ReturnTypeWillChange] |
| 60 | 60 | public function jsonSerialize() { |
| 61 | 61 | $result= ["type"=>$this->type]; |
| 62 | - if(isset($this->prompt)) |
|
| 63 | - $result["prompt"]=$this->prompt; |
|
| 64 | - if(isset($this->value)) |
|
| 65 | - $result["value"]=$this->value; |
|
| 62 | + if(isset($this->prompt)) { |
|
| 63 | + $result["prompt"]=$this->prompt; |
|
| 64 | + } |
|
| 65 | + if(isset($this->value)) { |
|
| 66 | + $result["value"]=$this->value; |
|
| 67 | + } |
|
| 66 | 68 | return $result; |
| 67 | 69 | } |
| 68 | 70 | |
@@ -94,8 +96,9 @@ discard block |
||
| 94 | 96 | * @return \Ajax\semantic\components\validation\Rule |
| 95 | 97 | */ |
| 96 | 98 | public static function integer($min=NULL,$max=NULL,$prompt=NULL){ |
| 97 | - if(\is_int($min) && \is_int($max)) |
|
| 98 | - return new Rule("integer[{$min}..{$max}]",$prompt); |
|
| 99 | + if(\is_int($min) && \is_int($max)) { |
|
| 100 | + return new Rule("integer[{$min}..{$max}]",$prompt); |
|
| 101 | + } |
|
| 99 | 102 | return new Rule("integer",$prompt); |
| 100 | 103 | } |
| 101 | 104 | |
@@ -291,8 +291,9 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) { |
| 293 | 293 | $result = $this->addInToolbar($caption, $callback); |
| 294 | - if (isset($icon) && method_exists($result, "addIcon")) |
|
| 295 | - $result->addIcon($icon); |
|
| 294 | + if (isset($icon) && method_exists($result, "addIcon")) { |
|
| 295 | + $result->addIcon($icon); |
|
| 296 | + } |
|
| 296 | 297 | return $result; |
| 297 | 298 | } |
| 298 | 299 | |
@@ -481,8 +482,9 @@ discard block |
||
| 481 | 482 | protected function _compileForm() { |
| 482 | 483 | if (isset($this->_form)) { |
| 483 | 484 | $noValidate = ""; |
| 484 | - if (\sizeof($this->_form->getValidationParams()) > 0) |
|
| 485 | - $noValidate = "novalidate"; |
|
| 485 | + if (\sizeof($this->_form->getValidationParams()) > 0) { |
|
| 486 | + $noValidate = "novalidate"; |
|
| 487 | + } |
|
| 486 | 488 | $this->wrapContent("<form class='" . $this->_form->getProperty('class') . "' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>"); |
| 487 | 489 | } |
| 488 | 490 | } |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | State::ERROR, |
| 27 | 27 | State::DISABLED |
| 28 | 28 | ]; |
| 29 | - if (isset($label) && $label !== "") |
|
| 30 | - $this->setLabel($label); |
|
| 29 | + if (isset($label) && $label !== "") { |
|
| 30 | + $this->setLabel($label); |
|
| 31 | + } |
|
| 31 | 32 | $this->setField($field); |
| 32 | 33 | $this->_validation = NULL; |
| 33 | 34 | } |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | * @return mixed |
| 60 | 61 | */ |
| 61 | 62 | public function getLabel() { |
| 62 | - if (\array_key_exists("label", $this->content)) |
|
| 63 | - return $this->content["label"]; |
|
| 63 | + if (\array_key_exists("label", $this->content)) { |
|
| 64 | + return $this->content["label"]; |
|
| 65 | + } |
|
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | /** |
@@ -145,7 +147,7 @@ discard block |
||
| 145 | 147 | if($type->getType()=='empty'){ |
| 146 | 148 | $this->addToProperty('class', 'required'); |
| 147 | 149 | } |
| 148 | - }elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') { |
|
| 150 | + } elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') { |
|
| 149 | 151 | $this->addToProperty('class', 'required'); |
| 150 | 152 | } |
| 151 | 153 | $this->_validation->addRule($type, $prompt, $value); |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function getParam($key) { |
| 41 | 41 | $value=null; |
| 42 | - if (array_key_exists($key, $this->params)) |
|
| 43 | - $value=$this->params [$key]; |
|
| 42 | + if (array_key_exists($key, $this->params)) { |
|
| 43 | + $value=$this->params [$key]; |
|
| 44 | + } |
|
| 44 | 45 | return $value; |
| 45 | 46 | } |
| 46 | 47 | |
@@ -49,16 +50,18 @@ discard block |
||
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | public function compile(JsUtils $js=NULL) { |
| 52 | - if ($js==NULL) |
|
| 53 | - $js=$this->js; |
|
| 53 | + if ($js==NULL) { |
|
| 54 | + $js=$this->js; |
|
| 55 | + } |
|
| 54 | 56 | $script=$this->getScript(); |
| 55 | 57 | $js->addToCompile($script); |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 59 | 61 | if (\is_array($typeCtrl)) { |
| 60 | - if (array_search($value, $typeCtrl)===false) |
|
| 61 | - throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 62 | + if (array_search($value, $typeCtrl)===false) { |
|
| 63 | + throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 64 | + } |
|
| 62 | 65 | } else { |
| 63 | 66 | if (!$typeCtrl($value)) { |
| 64 | 67 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); |
@@ -71,9 +74,9 @@ discard block |
||
| 71 | 74 | if(\is_array($params)) { |
| 72 | 75 | foreach ($params as $k => $v) { |
| 73 | 76 | $method = "set" . ucfirst($k); |
| 74 | - if (method_exists($this, $method)) |
|
| 75 | - $this->$method($v); |
|
| 76 | - else { |
|
| 77 | + if (method_exists($this, $method)) { |
|
| 78 | + $this->$method($v); |
|
| 79 | + } else { |
|
| 77 | 80 | $this->setParam($k, $v); |
| 78 | 81 | trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE); |
| 79 | 82 | } |