@@ -17,8 +17,9 @@ discard block |
||
| 17 | 17 | $value1=reset($input); |
| 18 | 18 | if (is_object($value1)) { |
| 19 | 19 | $output=PropertyWrapper::wrapObjects($input, $js, $separator=' '); |
| 20 | - } else |
|
| 21 | - $output=PropertyWrapper::wrapStrings($input, $separator=' ', $valueQuote='"'); |
|
| 20 | + } else { |
|
| 21 | + $output=PropertyWrapper::wrapStrings($input, $separator=' ', $valueQuote='"'); |
|
| 22 | + } |
|
| 22 | 23 | } |
| 23 | 24 | } |
| 24 | 25 | return $output; |
@@ -37,10 +38,11 @@ discard block |
||
| 37 | 38 | |
| 38 | 39 | public static function wrapObjects($input, $js=NULL, $separator=' ') { |
| 39 | 40 | return implode($separator, array_map(function ($v) use($js) { |
| 40 | - if (is_object($v)) |
|
| 41 | - return $v->compile($js); |
|
| 42 | - else |
|
| 43 | - return $v; |
|
| 41 | + if (is_object($v)) { |
|
| 42 | + return $v->compile($js); |
|
| 43 | + } else { |
|
| 44 | + return $v; |
|
| 45 | + } |
|
| 44 | 46 | }, $input)); |
| 45 | 47 | } |
| 46 | 48 | } |
| 47 | 49 | \ No newline at end of file |
@@ -29,15 +29,17 @@ |
||
| 29 | 29 | |
| 30 | 30 | public function addContent($content,$before=false) { |
| 31 | 31 | if (is_array($this->content)===false) { |
| 32 | - if(isset($this->content)) |
|
| 33 | - $this->content=array ($this->content); |
|
| 34 | - else |
|
| 35 | - $this->content=array(); |
|
| 32 | + if(isset($this->content)) { |
|
| 33 | + $this->content=array ($this->content); |
|
| 34 | + } else { |
|
| 35 | + $this->content=array(); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + if($before) { |
|
| 39 | + array_unshift($this->content,$content); |
|
| 40 | + } else { |
|
| 41 | + $this->content []=$content; |
|
| 36 | 42 | } |
| 37 | - if($before) |
|
| 38 | - array_unshift($this->content,$content); |
|
| 39 | - else |
|
| 40 | - $this->content []=$content; |
|
| 41 | 43 | return $this; |
| 42 | 44 | } |
| 43 | 45 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function addOption($element,$value="",$selected=false){ |
| 29 | 29 | if($element instanceof HtmlOption){ |
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
| 33 | 33 | } |
| 34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | foreach ($array as $k=>$v){ |
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | foreach ($array as $v){ |
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | if(is_array($element)){ |
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + } else if($element instanceof HtmlLink){ |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 72 | 72 | if(isset($glyph)){ |
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | if($this->absolutePaths===true){ |
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 117 | + } else{ |
|
| 118 | 118 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -204,8 +204,9 @@ discard block |
||
| 204 | 204 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
| 205 | 205 | $items[]=$action; |
| 206 | 206 | foreach ($params as $p){ |
| 207 | - if(\is_object($p)===false) |
|
| 208 | - $items[]=$p; |
|
| 207 | + if(\is_object($p)===false) { |
|
| 208 | + $items[]=$p; |
|
| 209 | + } |
|
| 209 | 210 | } |
| 210 | 211 | } |
| 211 | 212 | return $this->addElements($items); |
@@ -92,8 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function setCircular($inverted=false){ |
| 94 | 94 | $invertedStr=""; |
| 95 | - if($inverted!==false) |
|
| 96 | - $invertedStr=" inverted"; |
|
| 95 | + if($inverted!==false) { |
|
| 96 | + $invertedStr=" inverted"; |
|
| 97 | + } |
|
| 97 | 98 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
| 98 | 99 | } |
| 99 | 100 | |
@@ -110,8 +111,9 @@ discard block |
||
| 110 | 111 | */ |
| 111 | 112 | public function setBordered($inverted=false){ |
| 112 | 113 | $invertedStr=""; |
| 113 | - if($inverted!==false) |
|
| 114 | - $invertedStr=" inverted"; |
|
| 114 | + if($inverted!==false) { |
|
| 115 | + $invertedStr=" inverted"; |
|
| 116 | + } |
|
| 115 | 117 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
| 116 | 118 | } |
| 117 | 119 | |
@@ -22,8 +22,9 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function setAlignement($value="justified"){ |
| 25 | - if($value!=="justified") |
|
| 26 | - $value.=" aligned"; |
|
| 25 | + if($value!=="justified") { |
|
| 26 | + $value.=" aligned"; |
|
| 27 | + } |
|
| 27 | 28 | return $this->addToProperty("class", $value); |
| 28 | 29 | } |
| 29 | 30 | |
@@ -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); |
@@ -70,9 +73,9 @@ discard block |
||
| 70 | 73 | public function setParams($params) { |
| 71 | 74 | foreach ( $params as $k => $v ) { |
| 72 | 75 | $method="set".ucfirst($k); |
| 73 | - if (method_exists($this, $method)) |
|
| 74 | - $this->$method($v); |
|
| 75 | - else { |
|
| 76 | + if (method_exists($this, $method)) { |
|
| 77 | + $this->$method($v); |
|
| 78 | + } else { |
|
| 76 | 79 | $this->setParam($k, $v); |
| 77 | 80 | trigger_error("`".$k."` property n'existe pas", E_USER_NOTICE); |
| 78 | 81 | } |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
| 44 | - if(isset($this->_popup)) |
|
| 45 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
| 44 | + if(isset($this->_popup)) { |
|
| 45 | + $this->_popup->setAttributes($variation,$popupEvent); |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | public function compile(JsUtils $js=NULL, View $view=NULL){ |
| 85 | - if(isset($this->_popup)) |
|
| 86 | - $this->_popup->compile(); |
|
| 86 | + if(isset($this->_popup)) { |
|
| 87 | + $this->_popup->compile(); |
|
| 88 | + } |
|
| 87 | 89 | return parent::compile($js,$view); |
| 88 | 90 | } |
| 89 | 91 | public function run(JsUtils $js){ |
@@ -14,10 +14,12 @@ discard block |
||
| 14 | 14 | parent::__construct($identifier, "div"); |
| 15 | 15 | $this->setClass("item"); |
| 16 | 16 | $this->setContent($content); |
| 17 | - if($value!==NULL) |
|
| 18 | - $this->setData($value); |
|
| 19 | - if($image!==NULL) |
|
| 20 | - $this->asMiniAvatar($image); |
|
| 17 | + if($value!==NULL) { |
|
| 18 | + $this->setData($value); |
|
| 19 | + } |
|
| 20 | + if($image!==NULL) { |
|
| 21 | + $this->asMiniAvatar($image); |
|
| 22 | + } |
|
| 21 | 23 | } |
| 22 | 24 | |
| 23 | 25 | public function setDescription($description){ |
@@ -33,8 +35,9 @@ discard block |
||
| 33 | 35 | |
| 34 | 36 | public function asOption(){ |
| 35 | 37 | $this->tagName="option"; |
| 36 | - if($this->getProperty("data-value")!==null) |
|
| 37 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 38 | + if($this->getProperty("data-value")!==null) { |
|
| 39 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 40 | + } |
|
| 38 | 41 | } |
| 39 | 42 | |
| 40 | 43 | /** |
@@ -52,22 +55,25 @@ discard block |
||
| 52 | 55 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 53 | 56 | $this->setClass("ui icon search input"); |
| 54 | 57 | $input=new HtmlInput("search-".$this->identifier); |
| 55 | - if(isset($placeholder)) |
|
| 56 | - $input->setProperty("placeholder", $placeholder); |
|
| 58 | + if(isset($placeholder)) { |
|
| 59 | + $input->setProperty("placeholder", $placeholder); |
|
| 60 | + } |
|
| 57 | 61 | $this->content=$input; |
| 58 | - if(isset($icon)) |
|
| 59 | - $this->addIcon($icon); |
|
| 62 | + if(isset($icon)) { |
|
| 63 | + $this->addIcon($icon); |
|
| 64 | + } |
|
| 60 | 65 | return $this; |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | 68 | public function setContent($content){ |
| 64 | 69 | if($content==="-"){ |
| 65 | 70 | $this->asDivider(); |
| 66 | - }elseif($content==="-search-"){ |
|
| 71 | + } elseif($content==="-search-"){ |
|
| 67 | 72 | $values=\explode(",",$content,-1); |
| 68 | 73 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
| 69 | - }else |
|
| 70 | - parent::setContent($content); |
|
| 74 | + } else { |
|
| 75 | + parent::setContent($content); |
|
| 76 | + } |
|
| 71 | 77 | return $this; |
| 72 | 78 | } |
| 73 | 79 | |
@@ -79,8 +85,9 @@ discard block |
||
| 79 | 85 | public function asHeader($caption=NULL,$icon=NULL){ |
| 80 | 86 | $this->setClass("header"); |
| 81 | 87 | $this->content=$caption; |
| 82 | - if(isset($icon)) |
|
| 83 | - $this->addIcon($icon,true); |
|
| 88 | + if(isset($icon)) { |
|
| 89 | + $this->addIcon($icon,true); |
|
| 90 | + } |
|
| 84 | 91 | return $this; |
| 85 | 92 | } |
| 86 | 93 | |