Passed
Push — master ( 0c3e91...9673ec )
by Jean-Christophe
02:10
created
Ajax/semantic/html/content/HtmlAbsractItem.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 abstract class HtmlAbsractItem extends HtmlSemDoubleElement {
13 13
 
14
-	public function __construct($identifier, $baseClass,$content=NULL) {
14
+	public function __construct($identifier, $baseClass, $content=NULL) {
15 15
 		parent::__construct($identifier, "div", $baseClass);
16 16
 		$this->content=array();
17 17
 		$this->initContent($content);
@@ -19,73 +19,73 @@  discard block
 block discarded – undo
19 19
 
20 20
 	abstract protected function initContent($content);
21 21
 
22
-	public function setIcon($icon){
22
+	public function setIcon($icon) {
23 23
 		$this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon);
24 24
 	}
25 25
 
26
-	public function removeIcon(){
27
-		if(isset($this->content["icon"]))
26
+	public function removeIcon() {
27
+		if (isset($this->content["icon"]))
28 28
 			unset($this->content["icon"]);
29 29
 		return $this;
30 30
 	}
31 31
 
32
-	public function setImage($image){
32
+	public function setImage($image) {
33 33
 		$image=new HtmlImg("icon-".$this->identifier, $image);
34 34
 		$image->asAvatar();
35 35
 		$this->content["image"]=$image;
36 36
 	}
37 37
 
38
-	private function _getContent($key="content",$baseClass="content"){
39
-		if(\array_key_exists($key, $this->content)===false){
40
-			$this->content[$key]=new HtmlSemDoubleElement($key."-".$this->identifier,"div",$baseClass);
38
+	private function _getContent($key="content", $baseClass="content") {
39
+		if (\array_key_exists($key, $this->content)===false) {
40
+			$this->content[$key]=new HtmlSemDoubleElement($key."-".$this->identifier, "div", $baseClass);
41 41
 		}
42 42
 		return $this->content[$key];
43 43
 	}
44 44
 	
45
-	private function _getRightContent(){
46
-		return $this->_getContent("right-content","right floated content");
45
+	private function _getRightContent() {
46
+		return $this->_getContent("right-content", "right floated content");
47 47
 	}
48 48
 	
49
-	public function addContent($content,$before=false){
50
-		$this->_getContent("content")->addContent($content,$before);
49
+	public function addContent($content, $before=false) {
50
+		$this->_getContent("content")->addContent($content, $before);
51 51
 		return $this;
52 52
 	}
53 53
 	
54
-	public function addRightContent($content,$before=false){
55
-		$this->_getRightContent()->addContent($content,$before);
54
+	public function addRightContent($content, $before=false) {
55
+		$this->_getRightContent()->addContent($content, $before);
56 56
 		return $this;
57 57
 	}
58 58
 
59
-	public function setTitle($title,$description=NULL,$baseClass="title"){
60
-		$title=new HtmlSemDoubleElement("","div",$baseClass,$title);
59
+	public function setTitle($title, $description=NULL, $baseClass="title") {
60
+		$title=new HtmlSemDoubleElement("", "div", $baseClass, $title);
61 61
 		$content=$this->_getContent();
62 62
 		$content->addContent($title);
63
-		if(isset($description)){
64
-			$description=new HtmlSemDoubleElement("","div","description",$description);
63
+		if (isset($description)) {
64
+			$description=new HtmlSemDoubleElement("", "div", "description", $description);
65 65
 			$content->addContent($description);
66 66
 		}
67 67
 		return $this;
68 68
 	}
69 69
 
70
-	public function getPart($partName="header"){
71
-		$content=\array_merge($this->_getContent()->getContent(),array(@$this->content["icon"],@$this->content["image"]));
70
+	public function getPart($partName="header") {
71
+		$content=\array_merge($this->_getContent()->getContent(), array(@$this->content["icon"], @$this->content["image"]));
72 72
 		return $this->getElementByPropertyValue("class", $partName, $content);
73 73
 	}
74 74
 
75
-	public function setActive($value=true){
76
-		if($value){
75
+	public function setActive($value=true) {
76
+		if ($value) {
77 77
 			$this->setTagName("div");
78 78
 			$this->removeProperty("href");
79 79
 			$this->addToPropertyCtrl("class", "active", array("active"));
80
-		}else{
80
+		} else {
81 81
 			$this->removePropertyValue("class", "active");
82 82
 		}
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function asLink($href=NULL,$part=NULL){
86
+	public function asLink($href=NULL, $part=NULL) {
87 87
 		$this->setTagName("a");
88
-		if(isset($href))
88
+		if (isset($href))
89 89
 			$this->setProperty("href", $href);
90 90
 		return $this;
91 91
 	}
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
98 98
 	 */
99 99
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
100
-		if(\is_array($this->content) && JArray::isAssociative($this->content))
101
-			$this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]);
100
+		if (\is_array($this->content) && JArray::isAssociative($this->content))
101
+			$this->content=JArray::sortAssociative($this->content, ["right-content", "icon", "image", "content"]);
102 102
 		return parent::compile($js, $view);
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public function removeIcon(){
27
-		if(isset($this->content["icon"]))
28
-			unset($this->content["icon"]);
27
+		if(isset($this->content["icon"])) {
28
+					unset($this->content["icon"]);
29
+		}
29 30
 		return $this;
30 31
 	}
31 32
 
@@ -77,7 +78,7 @@  discard block
 block discarded – undo
77 78
 			$this->setTagName("div");
78 79
 			$this->removeProperty("href");
79 80
 			$this->addToPropertyCtrl("class", "active", array("active"));
80
-		}else{
81
+		} else{
81 82
 			$this->removePropertyValue("class", "active");
82 83
 		}
83 84
 		return $this;
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 
86 87
 	public function asLink($href=NULL,$part=NULL){
87 88
 		$this->setTagName("a");
88
-		if(isset($href))
89
-			$this->setProperty("href", $href);
89
+		if(isset($href)) {
90
+					$this->setProperty("href", $href);
91
+		}
90 92
 		return $this;
91 93
 	}
92 94
 
@@ -97,8 +99,9 @@  discard block
 block discarded – undo
97 99
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
98 100
 	 */
99 101
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
100
-		if(\is_array($this->content) && JArray::isAssociative($this->content))
101
-			$this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]);
102
+		if(\is_array($this->content) && JArray::isAssociative($this->content)) {
103
+					$this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]);
104
+		}
102 105
 		return parent::compile($js, $view);
103 106
 	}
104 107
 }
Please login to merge, or discard this patch.