Passed
Push — master ( ef71b3...70921f )
by Jean-Christophe
02:06
created
Ajax/common/html/HtmlDoubleElement.php 1 patch
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,15 +29,17 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function addContent($content,$before=false) {
31 31
 		if (!\is_array($this->content)) {
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
 
@@ -75,9 +77,9 @@  discard block
 block discarded – undo
75 77
 		$instances=[];
76 78
 		if($content instanceof $class){
77 79
 			$instances[]=$content;
78
-		}elseif($content instanceof HtmlDoubleElement){
80
+		} elseif($content instanceof HtmlDoubleElement){
79 81
 			$instances=\array_merge($instances,$content->getContentInstances($class));
80
-		}elseif (\is_array($content)){
82
+		} elseif (\is_array($content)){
81 83
 			foreach ($content as $element){
82 84
 				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
83 85
 			}
@@ -90,10 +92,12 @@  discard block
 block discarded – undo
90 92
 	 * @return HtmlDoubleElement
91 93
 	 */
92 94
 	public function asLink($href=NULL,$target=NULL) {
93
-		if (isset($href))
94
-			$this->setProperty("href", $href);
95
-		if(isset($target))
96
-			$this->setProperty("target", $target);
95
+		if (isset($href)) {
96
+					$this->setProperty("href", $href);
97
+		}
98
+		if(isset($target)) {
99
+					$this->setProperty("target", $target);
100
+		}
97 101
 		return $this->setTagName("a");
98 102
 	}
99 103
 }
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Braces   +13 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 			foreach ($items as $k=>$v){
25 25
 				$this->addItem([$k,$v]);
26 26
 			}
27
-		}else{
27
+		} else{
28 28
 			foreach ($items as $item){
29 29
 				$this->addItem($item);
30 30
 			}
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return \Ajax\common\html\HtmlDoubleElement
81 81
 	 */
82 82
 	public function getItem($index) {
83
-		if (is_int($index))
84
-			return $this->content[$index];
85
-		else {
83
+		if (is_int($index)) {
84
+					return $this->content[$index];
85
+		} else {
86 86
 			$elm=$this->getElementById($index, $this->content);
87 87
 			return $elm;
88 88
 		}
@@ -144,10 +144,11 @@  discard block
 block discarded – undo
144 144
 		$i=0;
145 145
 		foreach ($properties as $k=>$v){
146 146
 			$c=$this->content[$i++];
147
-			if(isset($c))
148
-				$c->setProperty($k,$v);
149
-			else
150
-				return $this;
147
+			if(isset($c)) {
148
+							$c->setProperty($k,$v);
149
+			} else {
150
+							return $this;
151
+			}
151 152
 		}
152 153
 		return $this;
153 154
 	}
@@ -167,8 +168,7 @@  discard block
 block discarded – undo
167 168
 			$c=$this->content[$i++];
168 169
 			if(isset($c)){
169 170
 				$c->setProperty($property,$value);
170
-			}
171
-			else{
171
+			} else{
172 172
 				return $this;
173 173
 			}
174 174
 		}
@@ -195,8 +195,9 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function asLinks($hrefs=[],$target=NUll) {
197 197
 		foreach ( $this->content as $index=>$item ) {
198
-			if($item instanceof HtmlDoubleElement && isset($hrefs[$index]))
199
-				$item->asLink($hrefs[$index],$target);
198
+			if($item instanceof HtmlDoubleElement && isset($hrefs[$index])) {
199
+							$item->asLink($hrefs[$index],$target);
200
+			}
200 201
 		}
201 202
 		return $this;
202 203
 	}
Please login to merge, or discard this patch.