Completed
Push — master ( 489615...9fed17 )
by Jean-Christophe
03:15
created
Ajax/bootstrap/html/HtmlButtongroups.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return HtmlButtongroups default : ""
40 40
 	 */
41 41
 	public function setSize($size) {
42
-		foreach ( $this->elements as $element ) {
42
+		foreach ($this->elements as $element) {
43 43
 			$element->setSize($size);
44 44
 		}
45 45
 		if (is_int($size)) {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
52
+		foreach ($this->elements as $element)
53 53
 			$element->setStyle($value);
54 54
 	}
55 55
 
@@ -69,25 +69,25 @@  discard block
 block discarded – undo
69 69
 	public function addElement($element) {
70 70
 		$result=$element;
71 71
 		$iid=sizeof($this->elements)+1;
72
-		if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) {
72
+		if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) {
73 73
 			$this->addExistingDropDown($element);
74 74
 		} elseif (\is_array($element)) {
75
-			$result=$this->_addArrayElement($element,$iid);
75
+			$result=$this->_addArrayElement($element, $iid);
76 76
 		} elseif (is_string($element)) {
77
-			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
77
+			$result=new HtmlButton($this->identifier."-button-".$iid, $element);
78 78
 		}
79
-		if($result instanceof HtmlButton)
79
+		if ($result instanceof HtmlButton)
80 80
 			$this->elements[]=$result;
81 81
 		return $result;
82 82
 	}
83 83
 
84
-	private function _addArrayElement(array $element,int $iid){
84
+	private function _addArrayElement(array $element, int $iid) {
85 85
 		if (array_key_exists("glyph", $element))
86 86
 			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87 87
 		elseif (array_key_exists("btnCaption", $element)) {
88 88
 			if (array_key_exists("split", $element))
89 89
 				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
90
+			else {
91 91
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 92
 				$this->dropdownAsButton($bt);
93 93
 			}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	public function addElements($elements) {
101
-		foreach ( $elements as $element ) {
101
+		foreach ($elements as $element) {
102 102
 			$this->addElement($element);
103 103
 		}
104 104
 		return $this;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		} else
119 119
 			$value="btn-group-".$value;
120 120
 		if (strstr($value, "justified")) {
121
-			foreach ( $this->elements as $element ) {
121
+			foreach ($this->elements as $element) {
122 122
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
123 123
 			}
124 124
 		}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
150 150
 	 */
151 151
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
152
-		foreach ( $this->elements as $element ) {
152
+		foreach ($this->elements as $element) {
153 153
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
154 154
 		}
155 155
 		return $this;
Please login to merge, or discard this patch.
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
53
-			$element->setStyle($value);
52
+		foreach ( $this->elements as $element ) {
53
+					$element->setStyle($value);
54
+		}
54 55
 	}
55 56
 
56 57
 	private function dropdownAsButton($bt) {
@@ -76,23 +77,25 @@  discard block
 block discarded – undo
76 77
 		} elseif (is_string($element)) {
77 78
 			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
78 79
 		}
79
-		if($result instanceof HtmlButton)
80
-			$this->elements[]=$result;
80
+		if($result instanceof HtmlButton) {
81
+					$this->elements[]=$result;
82
+		}
81 83
 		return $result;
82 84
 	}
83 85
 
84 86
 	private function _addArrayElement(array $element,int $iid){
85
-		if (array_key_exists("glyph", $element))
86
-			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87
-		elseif (array_key_exists("btnCaption", $element)) {
88
-			if (array_key_exists("split", $element))
89
-				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
87
+		if (array_key_exists("glyph", $element)) {
88
+					$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
89
+		} elseif (array_key_exists("btnCaption", $element)) {
90
+			if (array_key_exists("split", $element)) {
91
+							$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
92
+			} else{
91 93
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 94
 				$this->dropdownAsButton($bt);
93 95
 			}
94
-		} else
95
-			$bt=new HtmlButton($this->identifier."-button-".$iid);
96
+		} else {
97
+					$bt=new HtmlButton($this->identifier."-button-".$iid);
98
+		}
96 99
 		$bt->fromArray($element);
97 100
 		return $bt;
98 101
 	}
@@ -115,8 +118,9 @@  discard block
 block discarded – undo
115 118
 	public function setAlignment($value) {
116 119
 		if (is_int($value)) {
117 120
 			$value=CssRef::alignment("btn-group")[$value];
118
-		} else
119
-			$value="btn-group-".$value;
121
+		} else {
122
+					$value="btn-group-".$value;
123
+		}
120 124
 		if (strstr($value, "justified")) {
121 125
 			foreach ( $this->elements as $element ) {
122 126
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
@@ -131,9 +135,9 @@  discard block
 block discarded – undo
131 135
 	 * @return HtmlButton
132 136
 	 */
133 137
 	public function getElement($index) {
134
-		if (is_int($index))
135
-			return $this->elements[$index];
136
-		else {
138
+		if (is_int($index)) {
139
+					return $this->elements[$index];
140
+		} else {
137 141
 			$elm=$this->getElementById($index, $this->elements);
138 142
 			return $elm;
139 143
 		}
Please login to merge, or discard this patch.