Passed
Push — master ( a6eb21...a5e5c2 )
by Jean-Christophe
02:03
created
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@  discard block
 block discarded – undo
14 14
  * @author jc
15 15
  *
16 16
  */
17
-trait FormTrait{
17
+trait FormTrait {
18 18
 
19 19
 	/**
20 20
 	 * @return HtmlForm
21 21
 	 */
22 22
 	abstract protected function getForm();
23 23
 
24
-	protected function addCompoValidation(Form $compo,HtmlFormField $field){
24
+	protected function addCompoValidation(Form $compo, HtmlFormField $field) {
25 25
 		$validation=$field->getValidation();
26
-		if(isset($validation)){
26
+		if (isset($validation)) {
27 27
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
28 28
 			$compo->addFieldValidation($validation);
29 29
 		}
30 30
 		return $compo;
31 31
 	}
32 32
 
33
-	protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){
33
+	protected function _runValidationParams(Form &$compo, JsUtils $js=NULL) {
34 34
 		$form=$this->getForm();
35 35
 		$params=$form->getValidationParams();
36
-		if(isset($params["_ajaxSubmit"])){
37
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
36
+		if (isset($params["_ajaxSubmit"])) {
37
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
38 38
 			$this->onSuccess($compilation);
39 39
 			$form->removeValidationParam("_ajaxSubmit");
40 40
 		}
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		$form->addEventsOnRun($js);
44 44
 	}
45 45
 
46
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
46
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
47 47
 		$compilation="";
48
-		if(\is_array($ajaxSubmit)){
49
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
48
+		if (\is_array($ajaxSubmit)) {
49
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
50 50
 				$compilation.=$ajaxSubmitItem->compile($js);
51 51
 			}
52
-		}elseif($ajaxSubmit instanceof AjaxCall){
52
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
53 53
 			$compilation=$ajaxSubmit->compile($js);
54 54
 		}
55
-		$compilation=str_ireplace("\"","%quote%", $compilation);
55
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
56 56
 		return $compilation;
57 57
 	}
58 58
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 		return $this;
66 66
 	}
67 67
 
68
-	public function setAttached($value=true){
68
+	public function setAttached($value=true) {
69 69
 		$form=$this->getForm();
70
-		if($value)
71
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
70
+		if ($value)
71
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
72 72
 		return $form;
73 73
 	}
74 74
 
75
-	public function addErrorMessage(){
75
+	public function addErrorMessage() {
76 76
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
77 77
 	}
78 78
 
@@ -88,47 +88,47 @@  discard block
 block discarded – undo
88 88
 	 * @param array $parameters
89 89
 	 * @return HtmlForm
90 90
 	 */
91
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
91
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
92 92
 		$form=$this->getForm();
93
-		if($identifierOrElement  instanceof BaseHtml)
93
+		if ($identifierOrElement  instanceof BaseHtml)
94 94
 			$elem=$identifierOrElement;
95 95
 		else
96 96
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
97
-		if(isset($elem)){
98
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
97
+		if (isset($elem)) {
98
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
99 99
 		}
100 100
 		return $form;
101 101
 	}
102 102
 
103
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
104
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
103
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
104
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
105 105
 	}
106 106
 
107
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
108
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
109
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
107
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
108
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
109
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
110 110
 	}
111 111
 
112
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
112
+	protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
113 113
 		$form=$this->getForm();
114
-		if(isset($url) && isset($responseElement)){
115
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
116
-			$this->setSubmitParams($url,$responseElement,$parameters);
114
+		if (isset($url) && isset($responseElement)) {
115
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
116
+			$this->setSubmitParams($url, $responseElement, $parameters);
117 117
 		}
118 118
 		return $button;
119 119
 	}
120 120
 
121
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
121
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
122 122
 		$form=$this->getForm();
123
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
124
-		if(\is_array($parameters))
125
-			$params=\array_merge($params,$parameters);
123
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
124
+		if (\is_array($parameters))
125
+			$params=\array_merge($params, $parameters);
126 126
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function addReset($identifier,$value,$cssStyle=NULL){
131
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
130
+	public function addReset($identifier, $value, $cssStyle=NULL) {
131
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
132 132
 		$bt->setProperty("type", "reset");
133 133
 		return $bt;
134 134
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param string $jsCode
139 139
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
140 140
 	 */
141
-	public function onValid($jsCode){
141
+	public function onValid($jsCode) {
142 142
 		$form=$this->getForm();
143 143
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
144 144
 		return $form;
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 * @param string $jsCode can use event and fields parameters
150 150
 	 * @return HtmlForm
151 151
 	 */
152
-	public function onSuccess($jsCode){
152
+	public function onSuccess($jsCode) {
153 153
 		$form=$this->getForm();
154
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
154
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
155 155
 		return $form;
156 156
 	}
157 157
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param mixed $values
69 69
 	 */
70 70
 	public function setValues($values=array()) {
71
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
71
+		return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->setValue($value); });
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $values
77 77
 	 */
78 78
 	public function addValues($values=array()) {
79
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);});
79
+		return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->addValue($value); });
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * Sets or adds values to the row cols
84 84
 	 * @param mixed $values
85 85
 	 */
86
-	protected function _addOrSetValues($values,$callback) {
86
+	protected function _addOrSetValues($values, $callback) {
87 87
 		$count=$this->count();
88 88
 		if (!\is_array($values)) {
89 89
 			$values=\array_fill(0, $count, $values);
90 90
 		} else {
91
-			if (JArray::isAssociative($values) === true) {
91
+			if (JArray::isAssociative($values)===true) {
92 92
 				$values=\array_values($values);
93 93
 			}
94 94
 		}
95 95
 		$count=\min(\sizeof($values), $count);
96 96
 
97
-		for($i=0; $i < $count; $i++) {
97
+		for ($i=0; $i<$count; $i++) {
98 98
 			$cell=$this->content[$i];
99
-			$callback($cell,$values[$i]);
99
+			$callback($cell, $values[$i]);
100 100
 		}
101 101
 		return $this;
102 102
 	}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 
122 122
 	public function getColPosition($colIndex) {
123
-		if($this->_container->_isMerged()!==true)
123
+		if ($this->_container->_isMerged()!==true)
124 124
 			return $colIndex;
125 125
 		$pos=0;
126 126
 		$rows=$this->_container->getContent();
127
-		for($i=0; $i < $this->_row; $i++) {
127
+		for ($i=0; $i<$this->_row; $i++) {
128 128
 			$max=\min($colIndex, $rows[$i]->count());
129
-			for($j=0; $j < $max; $j++) {
129
+			for ($j=0; $j<$max; $j++) {
130 130
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
131
-				if ($rowspan + $i > $this->_row)
131
+				if ($rowspan+$i>$this->_row)
132 132
 					$pos++;
133 133
 			}
134 134
 		}
135
-		if ($pos > $colIndex)
135
+		if ($pos>$colIndex)
136 136
 			return NULL;
137 137
 		$count=$this->count();
138
-		for($i=0; $i < $count; $i++) {
138
+		for ($i=0; $i<$count; $i++) {
139 139
 			$pos+=$this->content[$i]->getColspan();
140
-			if ($pos >= $colIndex + 1)
140
+			if ($pos>=$colIndex+1)
141 141
 				return $i;
142 142
 		}
143 143
 		return null;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	public function conditionalCellFormat($callback, $format) {
147 147
 		$cells=$this->content;
148
-		foreach ( $cells as $cell ) {
148
+		foreach ($cells as $cell) {
149 149
 			$cell->conditionalCellFormat($callback, $format);
150 150
 		}
151 151
 		return $this;
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 
161 161
 	public function containsStr($needle) {
162 162
 		$cells=$this->content;
163
-		foreach ( $cells as $cell ) {
164
-			if (\strpos($cell->getContent(), $needle) !== false)
163
+		foreach ($cells as $cell) {
164
+			if (\strpos($cell->getContent(), $needle)!==false)
165 165
 				return true;
166 166
 		}
167 167
 		return false;
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function applyCells($callback) {
176 176
 		$cells=$this->content;
177
-		foreach ( $cells as $cell ) {
177
+		foreach ($cells as $cell) {
178 178
 			$cell->apply($callback);
179 179
 		}
180 180
 		return $this;
181 181
 	}
182 182
 
183
-	public function toDelete($colIndex){
183
+	public function toDelete($colIndex) {
184 184
 		$this->getItem($colIndex)->toDelete();
185 185
 		return $this;
186 186
 	}
Please login to merge, or discard this patch.
Ajax/php/symfony/Jquery_.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 	 * @param array $parameters
13 13
 	 * @return Response
14 14
 	 */
15
-	public function renderView($viewName,$parameters=[]){
15
+	public function renderView($viewName, $parameters=[]) {
16 16
 		$twig=$this->container->get("twig");
17 17
 		$this->compile($parameters);
18 18
 		return new Response($twig->render($viewName, $parameters));
19 19
 	}
20 20
 
21
-	public function generateUrl($path){
21
+	public function generateUrl($path) {
22 22
 		$request=Request::createFromGlobals();
23 23
 		return $request->getBaseUrl().$path;
24 24
 	}
Please login to merge, or discard this patch.
Ajax/php/symfony/JquerySemantic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class JquerySemantic extends Jquery_ {
8 8
 
9
-	public function __construct(RouterInterface $router,ContainerInterface $container ){
10
-		parent::__construct(["semantic"=>true,"defer"=>true],$router);
9
+	public function __construct(RouterInterface $router, ContainerInterface $container) {
10
+		parent::__construct(["semantic"=>true, "defer"=>true], $router);
11 11
 		$this->container=$container;
12 12
 	}
13 13
 }
Please login to merge, or discard this patch.
Ajax/php/symfony/JqueryBootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class JqueryBootstrap extends Jquery_ {
8 8
 
9
-	public function __construct(RouterInterface $router,ContainerInterface $container ){
10
-		parent::__construct(["bootstrap"=>true,"defer"=>true],$router);
9
+	public function __construct(RouterInterface $router, ContainerInterface $container) {
10
+		parent::__construct(["bootstrap"=>true, "defer"=>true], $router);
11 11
 		$this->container=$container;
12 12
 	}
13 13
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlDropdownItem.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,34 +12,34 @@  discard block
 block discarded – undo
12 12
 use Ajax\semantic\html\base\traits\MenuItemTrait;
13 13
 
14 14
 class HtmlDropdownItem extends HtmlSemDoubleElement {
15
-	use IconTrait,MenuItemTrait;
16
-	public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) {
15
+	use IconTrait, MenuItemTrait;
16
+	public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) {
17 17
 		parent::__construct($identifier, "a");
18 18
 		$this->setClass("item");
19 19
 		$this->setContent($content);
20
-		if($value!==NULL)
20
+		if ($value!==NULL)
21 21
 			$this->setData($value);
22
-		if($image!==NULL)
22
+		if ($image!==NULL)
23 23
 			$this->asMiniAvatar($image);
24
-		if($description!==NULL)
24
+		if ($description!==NULL)
25 25
 			$this->setDescription($description);
26 26
 	}
27 27
 
28
-	public function setDescription($description){
29
-		$descO=new HtmlDoubleElement("desc-".$this->identifier,"span");
28
+	public function setDescription($description) {
29
+		$descO=new HtmlDoubleElement("desc-".$this->identifier, "span");
30 30
 		$descO->setClass("description");
31 31
 		$descO->setContent($description);
32
-		return $this->addContent($descO,true);
32
+		return $this->addContent($descO, true);
33 33
 	}
34 34
 
35
-	public function setData($value){
35
+	public function setData($value) {
36 36
 		$this->setProperty("data-value", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function asOption(){
40
+	public function asOption() {
41 41
 		$this->tagName="option";
42
-		if($this->getProperty("data-value")!==null)
42
+		if ($this->getProperty("data-value")!==null)
43 43
 			$this->setProperty("value", $this->getProperty("data-value"));
44 44
 	}
45 45
 
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param string $image the image src
48 48
 	 * @return HtmlImg
49 49
 	 */
50
-	public function asMiniAvatar($image){
50
+	public function asMiniAvatar($image) {
51 51
 		$this->tagName="div";
52
-		$img=new HtmlImg("image-".$this->identifier,$image);
52
+		$img=new HtmlImg("image-".$this->identifier, $image);
53 53
 		$img->setClass("ui mini avatar image");
54
-		$this->addContent($img,true);
54
+		$this->addContent($img, true);
55 55
 		return $this;
56 56
 	}
57 57
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 * @param string $icon
61 61
 	 * @return HtmlDropdownItem
62 62
 	 */
63
-	public function asIcon($caption,$icon){
63
+	public function asIcon($caption, $icon) {
64 64
 		$this->setContent($caption);
65
-		$this->addContent(new HtmlIcon("", $icon),true);
65
+		$this->addContent(new HtmlIcon("", $icon), true);
66 66
 		return $this;
67 67
 	}
68 68
 
@@ -71,23 +71,23 @@  discard block
 block discarded – undo
71 71
 	 * @param string $color
72 72
 	 * @return HtmlDropdownItem
73 73
 	 */
74
-	public function asCircularLabel($caption,$color){
74
+	public function asCircularLabel($caption, $color) {
75 75
 		$this->setContent($caption);
76 76
 		$lbl=new HtmlLabel("");
77 77
 		$lbl->setCircular()->setColor($color)->setEmpty();
78
-		$this->addContent($lbl,true);
78
+		$this->addContent($lbl, true);
79 79
 		return $this;
80 80
 	}
81 81
 
82 82
 
83 83
 
84 84
 	public function addMenuItem($items) {
85
-		$menu=new HtmlMenu("menu-" . $this->identifier, $items);
85
+		$menu=new HtmlMenu("menu-".$this->identifier, $items);
86 86
 		$content=$this->content;
87 87
 		$this->setTagName("div");
88 88
 		$this->setProperty("class", "item");
89 89
 		$icon=new HtmlIcon("", "dropdown");
90
-		$this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu];
90
+		$this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu];
91 91
 		return $menu;
92 92
 	}
93 93
 
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	 * @param string $icon
97 97
 	 * @return HtmlDropdownItem
98 98
 	 */
99
-	public static function searchInput($placeholder=NULL,$icon=NULL){
100
-		return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon);
99
+	public static function searchInput($placeholder=NULL, $icon=NULL) {
100
+		return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon);
101 101
 	}
102 102
 
103 103
 	/**
104 104
 	 * @return HtmlDropdownItem
105 105
 	 */
106
-	public static function divider(){
106
+	public static function divider() {
107 107
 		return (new HtmlDropdownItem(""))->asDivider();
108 108
 	}
109 109
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @param string $icon
113 113
 	 * @return HtmlDropdownItem
114 114
 	 */
115
-	public static function header($caption=NULL,$icon=NULL){
116
-		return (new HtmlDropdownItem(""))->asHeader($caption,$icon);
115
+	public static function header($caption=NULL, $icon=NULL) {
116
+		return (new HtmlDropdownItem(""))->asHeader($caption, $icon);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param string $color
122 122
 	 * @return HtmlDropdownItem
123 123
 	 */
124
-	public static function circular($caption,$color){
125
-		return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color);
124
+	public static function circular($caption, $color) {
125
+		return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color);
126 126
 	}
127 127
 
128 128
 	/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 * @param string $icon
131 131
 	 * @return HtmlDropdownItem
132 132
 	 */
133
-	public static function icon($caption,$icon){
134
-		return (new HtmlDropdownItem(""))->asIcon($caption,$icon);
133
+	public static function icon($caption, $icon) {
134
+		return (new HtmlDropdownItem(""))->asIcon($caption, $icon);
135 135
 	}
136 136
 
137 137
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @param string $image
140 140
 	 * @return HtmlDropdownItem
141 141
 	 */
142
-	public static function avatar($caption,$image){
143
-		return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image);
142
+	public static function avatar($caption, $image) {
143
+		return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image);
144 144
 	}
145 145
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlModal.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	protected $_paramParts=array();
16 16
 
17 17
 	public function __construct($identifier, $header="", $content="", $actions=null) {
18
-		parent::__construct($identifier, "div","ui modal");
19
-		if(isset($header)){
18
+		parent::__construct($identifier, "div", "ui modal");
19
+		if (isset($header)) {
20 20
 			$this->setHeader($header);
21 21
 		}
22
-		if(isset($content)){
22
+		if (isset($content)) {
23 23
 			$this->setContent($content);
24 24
 		}
25
-		if(isset($actions)){
25
+		if (isset($actions)) {
26 26
 			$this->setActions($actions);
27 27
 		}
28 28
 	}
29 29
 
30 30
 	public function setHeader($value) {
31
-		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
31
+		$this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value);
32 32
 		return $this;
33 33
 	}
34 34
 
35 35
 	public function setContent($value) {
36
-		$this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value);
36
+		$this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40 40
 	public function setActions($actions) {
41
-		$this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions");
42
-		if(\is_array($actions)){
43
-			foreach ($actions as $action){
41
+		$this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions");
42
+		if (\is_array($actions)) {
43
+			foreach ($actions as $action) {
44 44
 				$this->addAction($action);
45 45
 			}
46 46
 		}
47
-		else{
47
+		else {
48 48
 			$this->addAction($actions);
49 49
 		}
50 50
 		return $this;
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
 	 * @param string|BaseHtml $action
55 55
 	 * @return HtmlButton
56 56
 	 */
57
-	public function addAction($action){
58
-		if(!$action instanceof BaseHtml){
57
+	public function addAction($action) {
58
+		if (!$action instanceof BaseHtml) {
59 59
 			$class="";
60
-			if(\array_search($action, ["Okay","Yes","Validate"])!==false){
60
+			if (\array_search($action, ["Okay", "Yes", "Validate"])!==false) {
61 61
 				$class="approve";
62 62
 			}
63
-			if(\array_search($action, ["Close","Cancel","No"])!==false){
63
+			if (\array_search($action, ["Close", "Cancel", "No"])!==false) {
64 64
 				$class="cancel";
65 65
 			}
66
-			$action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()),$action);
67
-			if($class!=="")
66
+			$action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()), $action);
67
+			if ($class!=="")
68 68
 				$action->addToProperty("class", $class);
69 69
 		}
70 70
 		return $this->addElementInPart($action, "actions");
@@ -74,66 +74,66 @@  discard block
 block discarded – undo
74 74
 	 * @param int $index
75 75
 	 * @return HtmlButton
76 76
 	 */
77
-	public function getAction($index){
77
+	public function getAction($index) {
78 78
 		return $this->content["actions"]->getContent()[$index];
79 79
 	}
80 80
 
81
-	public function addContent($content,$before=false){
82
-		$this->content["content"]->addContent($content,$before);
81
+	public function addContent($content, $before=false) {
82
+		$this->content["content"]->addContent($content, $before);
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function addImageContent($image,$description=NULL){
86
+	public function addImageContent($image, $description=NULL) {
87 87
 		$content=$this->content["content"];
88
-		if(isset($description)){
89
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
90
-			$content->addContent($description,true);
88
+		if (isset($description)) {
89
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
90
+			$content->addContent($description, true);
91 91
 		}
92
-		if($image!==""){
93
-			$img=new HtmlImage("image-".$this->identifier,$image,"","medium");
94
-			$content->addContent($img,true);
95
-			$content->addToProperty("class","image");
92
+		if ($image!=="") {
93
+			$img=new HtmlImage("image-".$this->identifier, $image, "", "medium");
94
+			$content->addContent($img, true);
95
+			$content->addToProperty("class", "image");
96 96
 		}
97 97
 		return $this;
98 98
 	}
99 99
 
100
-	public function addIconContent($icon,$description=NULL){
100
+	public function addIconContent($icon, $description=NULL) {
101 101
 		$content=$this->content["content"];
102
-		if(isset($description)){
103
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
104
-			$content->addContent($description,true);
102
+		if (isset($description)) {
103
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
104
+			$content->addContent($description, true);
105 105
 		}
106
-		if($icon!==""){
107
-			$img=new HtmlIcon("image-".$this->identifier,$icon);
108
-			$content->addContent($img,true);
109
-			$content->addToProperty("class","image");
106
+		if ($icon!=="") {
107
+			$img=new HtmlIcon("image-".$this->identifier, $icon);
108
+			$content->addContent($img, true);
109
+			$content->addToProperty("class", "image");
110 110
 		}
111 111
 		return $this;
112 112
 	}
113 113
 
114
-	private function addElementInPart($element,$part) {
114
+	private function addElementInPart($element, $part) {
115 115
 		$this->content[$part]->addContent($element);
116 116
 		return $element;
117 117
 	}
118 118
 
119
-	public function showDimmer($value){
120
-		$value=$value?"show":"hide";
119
+	public function showDimmer($value) {
120
+		$value=$value ? "show" : "hide";
121 121
 		$this->_paramParts[]=["'".$value." dimmer'"];
122 122
 		return $this;
123 123
 	}
124 124
 
125
-	public function setInverted($recursive=true){
125
+	public function setInverted($recursive=true) {
126 126
 		$this->_params["inverted"]=true;
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function setBasic(){
130
+	public function setBasic() {
131 131
 		return $this->addToProperty("class", "basic");
132 132
 	}
133 133
 
134 134
 
135
-	public function setTransition($value){
136
-		$this->_paramParts[]=["'setting'","'transition'","'".$value."'"];
135
+	public function setTransition($value) {
136
+		$this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"];
137 137
 	}
138 138
 
139 139
 	/**
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @param string $viewName
144 144
 	 * @param $params The parameters to pass to the view
145 145
 	 */
146
-	public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) {
147
-		return $this->setContent($js->renderContent($initialController, $viewName,$params));
146
+	public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) {
147
+		return $this->setContent($js->renderContent($initialController, $viewName, $params));
148 148
 	}
149 149
 
150 150
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $actionName the action name
156 156
 	 * @param array $params
157 157
 	 */
158
-	public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){
159
-		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params));
158
+	public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) {
159
+		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params));
160 160
 	}
161 161
 
162 162
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
167 167
 	 */
168 168
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
169
-		$this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]);
169
+		$this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]);
170 170
 		return parent::compile($js, $view);
171 171
 	}
172 172
 	/*
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @see BaseHtml::run()
175 175
 	 */
176 176
 	public function run(JsUtils $js) {
177
-		if(isset($this->_bsComponent)===false)
178
-			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
177
+		if (isset($this->_bsComponent)===false)
178
+			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts);
179 179
 		$this->addEventsOnRun($js);
180 180
 		return $this->_bsComponent;
181 181
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		return $this->jsDo("hide");
189 189
 	}
190 190
 
191
-	public function onHidden($js){
191
+	public function onHidden($js) {
192 192
 		$this->_params["onHidden"]=$js;
193 193
 	}
194 194
 }
Please login to merge, or discard this patch.
Ajax/service/JArray.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 class JArray {
6 6
 
7 7
 	public static function isAssociative($array) {
8
-		return (array_values($array) !== $array);
8
+		return (array_values($array)!==$array);
9 9
 	}
10 10
 
11 11
 	public static function getValue($array, $key, $pos) {
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 			return $array[$key];
14 14
 		}
15 15
 		$values=array_values($array);
16
-		if ($pos < sizeof($values))
16
+		if ($pos<sizeof($values))
17 17
 			return $values[$pos];
18 18
 	}
19 19
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 		$result=NULL;
22 22
 		if (array_key_exists($key, $array)) {
23 23
 			$result=$array[$key];
24
-			if ($condition($result) === true)
24
+			if ($condition($result)===true)
25 25
 				return $result;
26 26
 		}
27 27
 		$values=array_values($array);
28
-		foreach ( $values as $val ) {
29
-			if ($condition($val) === true)
28
+		foreach ($values as $val) {
29
+			if ($condition($val)===true)
30 30
 				return $val;
31 31
 		}
32 32
 		return $result;
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 		$result="";
44 44
 		if (\is_array($glue)) {
45 45
 			$size=\sizeof($pieces);
46
-			if ($size > 0) {
47
-				for($i=0; $i < $size - 1; $i++) {
48
-					$result.=$pieces[$i] . @$glue[$i];
46
+			if ($size>0) {
47
+				for ($i=0; $i<$size-1; $i++) {
48
+					$result.=$pieces[$i].@$glue[$i];
49 49
 				}
50
-				$result.=$pieces[$size - 1];
50
+				$result.=$pieces[$size-1];
51 51
 			}
52 52
 		} else {
53 53
 			$result=\implode($glue, $pieces);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public static function dimension($array) {
59 59
 		if (\is_array(reset($array))) {
60
-			$return=self::dimension(reset($array)) + 1;
60
+			$return=self::dimension(reset($array))+1;
61 61
 		} else {
62 62
 			$return=1;
63 63
 		}
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	public static function sortAssociative($array, $sortedKeys=array()) {
68
-		$newArray=array ();
69
-		foreach ( $sortedKeys as $key ) {
68
+		$newArray=array();
69
+		foreach ($sortedKeys as $key) {
70 70
 			if (\array_key_exists($key, $array)) {
71 71
 				$newArray[$key]=$array[$key];
72 72
 			}
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
 	public static function moveElementTo(&$array, $from, $to) {
78 78
 		$result=false;
79
-		if(isset($array)){
80
-			if(isset($array[$from])){
81
-				$out = array_splice($array, $from, 1);
79
+		if (isset($array)) {
80
+			if (isset($array[$from])) {
81
+				$out=array_splice($array, $from, 1);
82 82
 				array_splice($array, $to, 0, $out);
83 83
 				$result=true;
84 84
 			}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 		return $result;
87 87
 	}
88 88
 
89
-	public static function swapElements(&$array,$index1,$index2){
89
+	public static function swapElements(&$array, $index1, $index2) {
90 90
 		$result=false;
91
-		if(isset($array)){
92
-			if(isset($array[$index1])&& isset($array[$index2])){
91
+		if (isset($array)) {
92
+			if (isset($array[$index1]) && isset($array[$index2])) {
93 93
 				$tmp=$array[$index1];
94 94
 				$array[$index1]=$array[$index2];
95 95
 				$array[$index2]=$tmp;
@@ -100,33 +100,33 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 
103
-	public static function modelArray($objects,$identifierFunction=NULL,$modelFunction=NULL){
103
+	public static function modelArray($objects, $identifierFunction=NULL, $modelFunction=NULL) {
104 104
 		$result=[];
105
-		if(isset($modelFunction)===false){
105
+		if (isset($modelFunction)===false) {
106 106
 			$modelFunction="__toString";
107 107
 		}
108
-		if(isset($identifierFunction)===false){
109
-			foreach ($objects as $object){
108
+		if (isset($identifierFunction)===false) {
109
+			foreach ($objects as $object) {
110 110
 				$result[]=self::callFunction($object, $modelFunction);
111 111
 			}
112
-		}else{
113
-			foreach ($objects as $object){
112
+		} else {
113
+			foreach ($objects as $object) {
114 114
 				$result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction);
115 115
 			}
116 116
 		}
117 117
 		return $result;
118 118
 	}
119 119
 
120
-	private static function callFunction($object,$callback){
121
-		if(\is_string($callback))
122
-			return \call_user_func(array($object, $callback),[]);
123
-		else if (\is_callable($callback)){
120
+	private static function callFunction($object, $callback) {
121
+		if (\is_string($callback))
122
+			return \call_user_func(array($object, $callback), []);
123
+		else if (\is_callable($callback)) {
124 124
 			return $callback($object);
125 125
 		}
126 126
 	}
127 127
 
128
-	public static function count($array){
129
-		if(\is_array($array)){
128
+	public static function count($array) {
129
+		if (\is_array($array)) {
130 130
 			return \sizeof($array);
131 131
 		}
132 132
 		return 0;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
 use Ajax\common\html\HtmlDoubleElement;
16 16
 
17 17
 class HtmlDropdown extends HtmlSemDoubleElement {
18
-	use FieldTrait,LabeledIconTrait {
18
+	use FieldTrait, LabeledIconTrait {
19 19
 		addIcon as addIconP;
20 20
 	}
21 21
 	protected $mClass="menu";
22 22
 	protected $mTagName="div";
23
-	protected $items=array ();
24
-	protected $_params=array("action"=>"nothing","on"=>"hover","showOnFocus"=>false);
23
+	protected $items=array();
24
+	protected $_params=array("action"=>"nothing", "on"=>"hover", "showOnFocus"=>false);
25 25
 	protected $input;
26 26
 	protected $value;
27 27
 	protected $_associative;
28 28
 	protected $_multiple;
29 29
 
30
-	public function __construct($identifier, $value="", $items=array(),$associative=true) {
30
+	public function __construct($identifier, $value="", $items=array(), $associative=true) {
31 31
 		parent::__construct($identifier, "div");
32 32
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
33 33
 		$this->setProperty("class", "ui dropdown");
34 34
 		$this->_multiple=false;
35 35
 		$content=[];
36
-		if(isset($value)){
37
-			if($value instanceof HtmlSemDoubleElement){
36
+		if (isset($value)) {
37
+			if ($value instanceof HtmlSemDoubleElement) {
38 38
 				$text=$value;
39
-			}else{
40
-				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
39
+			} else {
40
+				$text=new HtmlSemDoubleElement("text-".$this->identifier, "div");
41 41
 				$text->setClass("text");
42 42
 				$this->setValue($value);
43 43
 			}
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 		$this->addItems($items);
51 51
 	}
52 52
 
53
-	public function getField(){
53
+	public function getField() {
54 54
 		return $this->input;
55 55
 	}
56 56
 
57
-	public function getDataField(){
57
+	public function getDataField() {
58 58
 		return $this->input;
59 59
 	}
60 60
 
61
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
62
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
61
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
62
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
63 63
 		$this->items[]=$itemO;
64 64
 		return $itemO;
65 65
 	}
66 66
 
67
-	public function addIcon($icon,$before=true,$labeled=false){
67
+	public function addIcon($icon, $before=true, $labeled=false) {
68 68
 		$this->removeArrow();
69
-		$this->addIconP($icon,$before,$labeled);
69
+		$this->addIconP($icon, $before, $labeled);
70 70
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
71 71
 	}
72 72
 
73
-	public function addIcons($icons){
73
+	public function addIcons($icons) {
74 74
 		$count=$this->count();
75
-		for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){
75
+		for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) {
76 76
 			$this->getItem($i)->addIcon($icons[$i]);
77 77
 		}
78 78
 	}
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
 	 * @param int $position
84 84
 	 * @return HtmlDropdownItem
85 85
 	 */
86
-	public function insertItem($item,$position=0){
86
+	public function insertItem($item, $position=0) {
87 87
 		$itemO=$this->beforeAddItem($item);
88
-		 $start = array_slice($this->items, 0, $position);
89
-		 $end = array_slice($this->items, $position);
90
-		 $start[] = $item;
88
+		 $start=array_slice($this->items, 0, $position);
89
+		 $end=array_slice($this->items, $position);
90
+		 $start[]=$item;
91 91
 		 $this->items=array_merge($start, $end);
92 92
 		 return $itemO;
93 93
 	}
94 94
 
95
-	protected function removeArrow(){
96
-		if(\sizeof($this->content)>1){
95
+	protected function removeArrow() {
96
+		if (\sizeof($this->content)>1) {
97 97
 			unset($this->content["arrow"]);
98 98
 			$this->content=\array_values($this->content);
99 99
 		}
100 100
 	}
101 101
 
102
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
102
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
103 103
 		$itemO=$item;
104
-		if(\is_array($item)){
104
+		if (\is_array($item)) {
105 105
 			$description=JArray::getValue($item, "description", 3);
106 106
 			$value=JArray::getValue($item, "value", 1);
107 107
 			$image=JArray::getValue($item, "image", 2);
108 108
 			$item=JArray::getValue($item, "item", 0);
109 109
 		}
110
-		if(!$item instanceof HtmlDropdownItem){
111
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
112
-		}elseif($itemO instanceof HtmlDropdownItem){
110
+		if (!$item instanceof HtmlDropdownItem) {
111
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
112
+		}elseif ($itemO instanceof HtmlDropdownItem) {
113 113
 			$this->addToProperty("class", "vertical");
114 114
 		}
115 115
 		return $itemO;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		$this->addItem($function($object));
123 123
 	}
124 124
 
125
-	public function addInput($name){
126
-		if(!isset($name))
125
+	public function addInput($name) {
126
+		if (!isset($name))
127 127
 			$name="input-".$this->identifier;
128 128
 		$this->setAction("activate");
129
-		$this->input=new HtmlInput($name,"hidden");
129
+		$this->input=new HtmlInput($name, "hidden");
130 130
 		$this->input->setIdentifier("input-".$this->identifier);
131 131
 		return $this->input;
132 132
 	}
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param string $icon
138 138
 	 * @return HtmlDropdownItem
139 139
 	 */
140
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
141
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
140
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
141
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
142 142
 	}
143 143
 
144 144
 	/**
145 145
 	 * Adds a divider item
146 146
 	 * @return HtmlDropdownItem
147 147
 	 */
148
-	public function addDividerItem(){
148
+	public function addDividerItem() {
149 149
 		return $this->addItem(HtmlDropdownItem::divider());
150 150
 	}
151 151
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $icon
156 156
 	 * @return HtmlDropdownItem
157 157
 	 */
158
-	public function addHeaderItem($caption=NULL,$icon=NULL){
159
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
158
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
159
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
160 160
 	}
161 161
 
162 162
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param string $color
166 166
 	 * @return HtmlDropdownItem
167 167
 	 */
168
-	public function addCircularLabelItem($caption,$color){
168
+	public function addCircularLabelItem($caption, $color) {
169 169
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
170 170
 	}
171 171
 
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 	 * @param string $image
175 175
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
176 176
 	 */
177
-	public function addMiniAvatarImageItem($caption,$image){
177
+	public function addMiniAvatarImageItem($caption, $image) {
178 178
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
179 179
 	}
180 180
 
181
-	public function addItems($items){
182
-		if(\is_array($items) && $this->_associative){
183
-			foreach ($items as $k=>$v){
181
+	public function addItems($items) {
182
+		if (\is_array($items) && $this->_associative) {
183
+			foreach ($items as $k=>$v) {
184 184
 				$this->addItem($v)->setData($k);
185 185
 			}
186
-		}else{
187
-			foreach ($items as $item){
186
+		} else {
187
+			foreach ($items as $item) {
188 188
 				$this->addItem($item);
189 189
 			}
190 190
 		}
@@ -196,98 +196,98 @@  discard block
 block discarded – undo
196 196
 	 * @param array $values
197 197
 	 * @return HtmlCollection
198 198
 	 */
199
-	public function setPropertyValues($property,$values){
199
+	public function setPropertyValues($property, $values) {
200 200
 		$i=0;
201
-		if(\is_array($values)===false){
202
-			$values=\array_fill(0, $this->count(),$values);
201
+		if (\is_array($values)===false) {
202
+			$values=\array_fill(0, $this->count(), $values);
203 203
 		}
204
-		foreach ($values as $value){
204
+		foreach ($values as $value) {
205 205
 			$c=$this->items[$i++];
206
-			if(isset($c)){
207
-				$c->setProperty($property,$value);
206
+			if (isset($c)) {
207
+				$c->setProperty($property, $value);
208 208
 			}
209
-			else{
209
+			else {
210 210
 				return $this;
211 211
 			}
212 212
 		}
213 213
 		return $this;
214 214
 	}
215 215
 
216
-	public function each($callBack){
217
-		foreach ($this->items as $index=>$value){
218
-			$callBack($index,$value);
216
+	public function each($callBack) {
217
+		foreach ($this->items as $index=>$value) {
218
+			$callBack($index, $value);
219 219
 		}
220 220
 		return $this;
221 221
 	}
222 222
 
223
-	public function getItem($index){
223
+	public function getItem($index) {
224 224
 		return $this->items[$index];
225 225
 	}
226 226
 
227 227
 	/**
228 228
 	 * @return int
229 229
 	 */
230
-	public function count(){
230
+	public function count() {
231 231
 		return \sizeof($this->items);
232 232
 	}
233 233
 	/**
234 234
 	 * @param boolean $dropdown
235 235
 	 */
236
-	public function asDropdown($dropdown){
237
-		if($dropdown===false){
236
+	public function asDropdown($dropdown) {
237
+		if ($dropdown===false) {
238 238
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
239 239
 			$dropdown="menu";
240
-		}else{
240
+		} else {
241 241
 			$dropdown="dropdown";
242 242
 			$this->mClass="menu";
243 243
 		}
244
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
244
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
245 245
 	}
246 246
 
247
-	public function setVertical(){
248
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
247
+	public function setVertical() {
248
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
249 249
 	}
250 250
 
251
-	public function setInline(){
252
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
251
+	public function setInline() {
252
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
253 253
 	}
254 254
 
255
-	public function setSimple(){
256
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
255
+	public function setSimple() {
256
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
257 257
 	}
258 258
 
259
-	public function asButton($floating=false){
259
+	public function asButton($floating=false) {
260 260
 		$this->removeArrow();
261
-		if($floating)
261
+		if ($floating)
262 262
 			$this->addToProperty("class", "floating");
263 263
 		$this->removePropertyValue("class", "selection");
264 264
 		return $this->addToProperty("class", "button");
265 265
 	}
266 266
 
267
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
267
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
268 268
 		$this->_multiple=$multiple;
269
-		if(isset($name))
269
+		if (isset($name))
270 270
 			$this->addInput($name);
271
-		if($multiple){
271
+		if ($multiple) {
272 272
 			$this->addToProperty("class", "multiple");
273 273
 		}
274
-		if ($selection){
275
-			if($this->propertyContains("class", "button")===false)
276
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
274
+		if ($selection) {
275
+			if ($this->propertyContains("class", "button")===false)
276
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
277 277
 		}
278 278
 		return $this;
279 279
 	}
280 280
 
281
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
282
-		$this->asSelect($name,$multiple,$selection);
281
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
282
+		$this->asSelect($name, $multiple, $selection);
283 283
 		return $this->addToProperty("class", "search");
284 284
 	}
285 285
 
286
-	public function setSelect($name=NULL,$multiple=false){
287
-		if(!isset($name))
286
+	public function setSelect($name=NULL, $multiple=false) {
287
+		if (!isset($name))
288 288
 			$name="select-".$this->identifier;
289 289
 		$this->input=null;
290
-		if($multiple){
290
+		if ($multiple) {
291 291
 			$this->setProperty("multiple", true);
292 292
 			$this->addToProperty("class", "multiple");
293 293
 		}
@@ -295,37 +295,37 @@  discard block
 block discarded – undo
295 295
 		$this->tagName="select";
296 296
 		$this->setProperty("name", $name);
297 297
 		$this->content=null;
298
-		foreach ($this->items as $item){
298
+		foreach ($this->items as $item) {
299 299
 			$item->asOption();
300 300
 		}
301 301
 		return $this;
302 302
 	}
303 303
 
304
-	public function asSubmenu($pointing=NULL){
304
+	public function asSubmenu($pointing=NULL) {
305 305
 		$this->setClass("ui dropdown link item");
306
-		if(isset($pointing)){
306
+		if (isset($pointing)) {
307 307
 			$this->setPointing($pointing);
308 308
 		}
309 309
 		return $this;
310 310
 	}
311 311
 
312
-	public function setPointing($value=Direction::NONE){
313
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
312
+	public function setPointing($value=Direction::NONE) {
313
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
314 314
 	}
315 315
 
316
-	public function setValue($value){
316
+	public function setValue($value) {
317 317
 		$this->value=$value;
318 318
 		return $this;
319 319
 	}
320
-	private function applyValue(){
320
+	private function applyValue() {
321 321
 		$value=$this->value;
322
-		if(isset($this->input) && isset($value)){
322
+		if (isset($this->input) && isset($value)) {
323 323
 			$this->input->setProperty("value", $value);
324
-		}else{
324
+		} else {
325 325
 			$this->setProperty("value", $value);
326 326
 		}
327 327
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
328
-			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
328
+			if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
329 329
 				$textElement->setContent($value);
330 330
 		return $this;
331 331
 	}
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @see BaseHtml::run()
336 336
 	 */
337 337
 	public function run(JsUtils $js) {
338
-		if($this->propertyContains("class", "simple")===false){
339
-			if(isset($this->_bsComponent)===false){
340
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
338
+		if ($this->propertyContains("class", "simple")===false) {
339
+			if (isset($this->_bsComponent)===false) {
340
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
341 341
 				$this->_bsComponent->setItemSelector(".item");
342 342
 			}
343 343
 			$this->addEventsOnRun($js);
@@ -345,41 +345,41 @@  discard block
 block discarded – undo
345 345
 		}
346 346
 	}
347 347
 
348
-	public function setCompact(){
348
+	public function setCompact() {
349 349
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
350 350
 	}
351 351
 
352
-	public function setAction($action){
352
+	public function setAction($action) {
353 353
 		$this->_params["action"]=$action;
354 354
 	}
355 355
 
356
-	public function setOn($on){
356
+	public function setOn($on) {
357 357
 		$this->_params["on"]=$on;
358 358
 	}
359 359
 
360
-	public function setShowOnFocus($value){
360
+	public function setShowOnFocus($value) {
361 361
 		$this->_params["showOnFocus"]=$value;
362 362
 	}
363 363
 
364
-	public function setFullTextSearch($value){
364
+	public function setFullTextSearch($value) {
365 365
 		$this->_params["fullTextSearch"]=$value;
366 366
 	}
367 367
 
368 368
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
369 369
 		$this->applyValue();
370
-		return parent::compile($js,$view);
370
+		return parent::compile($js, $view);
371 371
 	}
372 372
 
373 373
 	public function getInput() {
374 374
 		return $this->input;
375 375
 	}
376 376
 
377
-	public function setIcon($icon="dropdown"){
377
+	public function setIcon($icon="dropdown") {
378 378
 		$this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon);
379 379
 		return $this;
380 380
 	}
381 381
 
382
-	public function jsAddItem($caption){
382
+	public function jsAddItem($caption) {
383 383
 		$js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')";
384 384
 		return $js;
385 385
 	}
Please login to merge, or discard this patch.