Passed
Push — master ( dfdbfa...a2ea10 )
by Jean-Christophe
03:02
created
Ajax/semantic/html/elements/HtmlIcon.php 2 patches
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,8 +89,9 @@  discard block
 block discarded – undo
89 89
 	public function asLink($href=NULL,$target=NULL) {
90 90
 		if (isset($href)) {
91 91
 			$_target="";
92
-			if(isset($target))
93
-				$_target="target='{$target}'";
92
+			if(isset($target)) {
93
+							$_target="target='{$target}'";
94
+			}
94 95
 			$this->wrap("<a href='" . $href . "' {$_target}>", "</a>");
95 96
 		}
96 97
 		return $this->addToProperty("class", "link");
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
 	 */
108 109
 	public function setBordered($inverted=false) {
109 110
 		$invertedStr="";
110
-		if ($inverted !== false)
111
-			$invertedStr=" inverted";
111
+		if ($inverted !== false) {
112
+					$invertedStr=" inverted";
113
+		}
112 114
 		return $this->addToProperty("class", "bordered" . $invertedStr);
113 115
 	}
114 116
 
@@ -121,12 +123,14 @@  discard block
 block discarded – undo
121 123
 	}
122 124
 
123 125
 	public function addLabel($label, $before=false, $icon=NULL) {
124
-		if($before)
125
-			$this->wrap($label);
126
-		else
127
-			$this->wrap("", $label);
128
-		if(isset($icon))
129
-			$this->addToIcon($icon);
126
+		if($before) {
127
+					$this->wrap($label);
128
+		} else {
129
+					$this->wrap("", $label);
130
+		}
131
+		if(isset($icon)) {
132
+					$this->addToIcon($icon);
133
+		}
130 134
 		return $this;
131 135
 	}
132 136
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return HtmlIcon
70 70
 	 */
71 71
 	public function setFlipped($sens="horizontally") {
72
-		return $this->addToProperty("class", "flipped " . $sens);
72
+		return $this->addToProperty("class", "flipped ".$sens);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return HtmlIcon
79 79
 	 */
80 80
 	public function setRotated($sens="clockwise") {
81
-		return $this->addToProperty("class", "rotated " . $sens);
81
+		return $this->addToProperty("class", "rotated ".$sens);
82 82
 	}
83 83
 
84 84
 	/**
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 * @param string $target
88 88
 	 * @return HtmlIcon
89 89
 	 */
90
-	public function asLink($href=NULL,$target=NULL) {
90
+	public function asLink($href=NULL, $target=NULL) {
91 91
 		if (isset($href)) {
92 92
 			$_target="";
93
-			if(isset($target))
93
+			if (isset($target))
94 94
 				$_target="target='{$target}'";
95
-			$this->wrap("<a href='" . $href . "' {$_target}>", "</a>");
95
+			$this->wrap("<a href='".$href."' {$_target}>", "</a>");
96 96
 		}
97 97
 		return $this->addToProperty("class", "link");
98 98
 	}
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function setBordered($inverted=false) {
110 110
 		$invertedStr="";
111
-		if ($inverted !== false)
111
+		if ($inverted!==false)
112 112
 			$invertedStr=" inverted";
113
-		return $this->addToProperty("class", "bordered" . $invertedStr);
113
+		return $this->addToProperty("class", "bordered".$invertedStr);
114 114
 	}
115 115
 
116 116
 	/**
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 	public function addLabel($label, $before=false, $icon=NULL) {
125
-		if($before)
125
+		if ($before)
126 126
 			$this->wrap($label);
127 127
 		else
128 128
 			$this->wrap("", $label);
129
-		if(isset($icon))
129
+		if (isset($icon))
130 130
 			$this->addToIcon($icon);
131 131
 		return $this;
132 132
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlSticky.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
 
8 8
 class HtmlSticky extends HtmlSemDoubleElement {
9 9
 
10
-	public function __construct($identifier,$context=NULL,$content=NULL) {
10
+	public function __construct($identifier, $context=NULL, $content=NULL) {
11 11
 		parent::__construct($identifier, "div", "ui sticky", $content);
12
-		if(isset($content))
12
+		if (isset($content))
13 13
 			$this->setContext($context);
14 14
 	}
15 15
 
16
-	public function setContext($context){
16
+	public function setContext($context) {
17 17
 		$this->_params["context"]=$context;
18 18
 		return $this;
19 19
 	}
20 20
 
21
-	public function setFixed($value=NULL){
21
+	public function setFixed($value=NULL) {
22 22
 		$fixed="fixed";
23
-		if(isset($value))
23
+		if (isset($value))
24 24
 			$fixed.=" ".$value;
25
-		return $this->addToProperty("class",$fixed);
25
+		return $this->addToProperty("class", $fixed);
26 26
 	}
27 27
 
28
-	public function setBound($value=NULL){
28
+	public function setBound($value=NULL) {
29 29
 		$bound="bound";
30
-		if(isset($value))
30
+		if (isset($value))
31 31
 			$bound.=" ".$value;
32
-			return $this->addToProperty("class",$bound);
32
+			return $this->addToProperty("class", $bound);
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * {@inheritDoc}
37 37
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
38 38
 	 */
39
-	public function run(JsUtils $js){
39
+	public function run(JsUtils $js) {
40 40
 		parent::run($js);
41
-		return $js->semantic()->sticky("#".$this->identifier,$this->_params);
41
+		return $js->semantic()->sticky("#".$this->identifier, $this->_params);
42 42
 	}
43 43
 
44
-	public function setOffset($offset=0){
44
+	public function setOffset($offset=0) {
45 45
 		$this->_params["offset"]=$offset;
46 46
 		return $this;
47 47
 	}
48 48
 
49 49
 
50 50
 
51
-	public function setDebug($verbose=NULL){
51
+	public function setDebug($verbose=NULL) {
52 52
 		$this->_params["debug"]=true;
53
-		if(isset($verbose))
53
+		if (isset($verbose))
54 54
 			$this->_params["verbose"]=true;
55 55
 		return $this;
56 56
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 	public function __construct($identifier,$context=NULL,$content=NULL) {
11 11
 		parent::__construct($identifier, "div", "ui sticky", $content);
12
-		if(isset($content))
13
-			$this->setContext($context);
12
+		if(isset($content)) {
13
+					$this->setContext($context);
14
+		}
14 15
 	}
15 16
 
16 17
 	public function setContext($context){
@@ -20,15 +21,17 @@  discard block
 block discarded – undo
20 21
 
21 22
 	public function setFixed($value=NULL){
22 23
 		$fixed="fixed";
23
-		if(isset($value))
24
-			$fixed.=" ".$value;
24
+		if(isset($value)) {
25
+					$fixed.=" ".$value;
26
+		}
25 27
 		return $this->addToProperty("class",$fixed);
26 28
 	}
27 29
 
28 30
 	public function setBound($value=NULL){
29 31
 		$bound="bound";
30
-		if(isset($value))
31
-			$bound.=" ".$value;
32
+		if(isset($value)) {
33
+					$bound.=" ".$value;
34
+		}
32 35
 			return $this->addToProperty("class",$bound);
33 36
 	}
34 37
 
@@ -50,8 +53,9 @@  discard block
 block discarded – undo
50 53
 
51 54
 	public function setDebug($verbose=NULL){
52 55
 		$this->_params["debug"]=true;
53
-		if(isset($verbose))
54
-			$this->_params["verbose"]=true;
56
+		if(isset($verbose)) {
57
+					$this->_params["verbose"]=true;
58
+		}
55 59
 		return $this;
56 60
 	}
57 61
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/HasTimeoutTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 	 * {@inheritDoc}
18 18
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
19 19
 	 */
20
-	public function run(JsUtils $js){
21
-		if(!isset($this->_bsComponent)){
22
-			if(isset($this->_timeout)){
23
-				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true);
20
+	public function run(JsUtils $js) {
21
+		if (!isset($this->_bsComponent)) {
22
+			if (isset($this->_timeout)) {
23
+				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true);
24 24
 			}
25 25
 		}
26 26
 		return parent::run($js);
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,15 +22,17 @@
 block discarded – undo
22 22
 
23 23
 	public function setBasic($very=false) {
24 24
 		$table=$this->_self;
25
-		if ($very)
26
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
25
+		if ($very) {
26
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
27
+		}
27 28
 		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
28 29
 	}
29 30
 
30 31
 	public function setCompact($very=false) {
31 32
 		$table=$this->_self;
32
-		if ($very)
33
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
33
+		if ($very) {
34
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
35
+		}
34 36
 		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
35 37
 	}
36 38
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  * @author jc
9 9
  * @property HtmlTable $_self
10 10
  */
11
-trait TableTrait{
11
+trait TableTrait {
12 12
 
13 13
 	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
14 14
 	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
15 15
 	
16
-	protected function addToPropertyTable($property,$value){
16
+	protected function addToPropertyTable($property, $value) {
17 17
 		return $this->_self->addToProperty($property, $value);
18 18
 	}
19 19
 
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 	public function setBasic($very=false) {
25 25
 		$table=$this->_self;
26 26
 		if ($very)
27
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
28
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
27
+			$table->addToPropertyCtrl("class", "very", array("very"));
28
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
29 29
 	}
30 30
 
31 31
 	public function setCompact($very=false) {
32 32
 		$table=$this->_self;
33 33
 		if ($very)
34
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
35
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
34
+			$table->addToPropertyCtrl("class", "very", array("very"));
35
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
36 36
 	}
37 37
 
38 38
 	public function setCollapsing() {
@@ -71,41 +71,41 @@  discard block
 block discarded – undo
71 71
 		return $this->addToPropertyTable("class", "striped");
72 72
 	}
73 73
 
74
-	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){
75
-		return $this->onRow("click", $jsCode,$stopPropagation,$preventDefault);
74
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
75
+		return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
76 76
 	}
77 77
 
78
-	public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){
79
-		return $this->_self->addEvent($event."{{tbody tr}}",$jsCode,$stopPropagation,$preventDefault);
78
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
79
+		return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
80 80
 	}
81 81
 
82
-	public function getOnRow($event, $url, $responseElement="", $parameters=array()){
83
-		$parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false,"jsCondition"=>'!$(this).closest("tr").hasClass("active")']);
82
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
83
+		$parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false, "jsCondition"=>'!$(this).closest("tr").hasClass("active")']);
84 84
 		$selector="tbody tr";
85
-		if(isset($parameters["selector"])){
85
+		if (isset($parameters["selector"])) {
86 86
 			$selector=$parameters["selector"];
87 87
 		}
88
-		return $this->_self->getOn($event."{{".$selector."}}", $url,$responseElement,$parameters);
88
+		return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters);
89 89
 	}
90 90
 	
91
-	public function onPageChange($jsCode){
91
+	public function onPageChange($jsCode) {
92 92
 		$this->_self->_addEvent("pageChange", $jsCode);
93 93
 		return $this;
94 94
 	}
95 95
 	
96
-	public function onSearchTerminate($jsCode){
96
+	public function onSearchTerminate($jsCode) {
97 97
 		$this->_self->_addEvent("searchTerminate", $jsCode);
98 98
 		return $this;
99 99
 	}
100 100
 	
101
-	public function getEventsScript(){
101
+	public function getEventsScript() {
102 102
 		return $this->_self->getBsComponent()->getScript();
103 103
 	}
104 104
 	
105 105
 	public function addEventsOnRun(JsUtils $js=NULL) {
106 106
 		$script=parent::addEventsOnRun($js);
107 107
 		$innerScript=$this->_self->getInnerScript();
108
-		if(!isset($innerScript)){
108
+		if (!isset($innerScript)) {
109 109
 			$this->_self->setInnerScript($script);
110 110
 		}
111 111
 		return $script;
Please login to merge, or discard this patch.
Ajax/semantic/html/views/HtmlCardGroups.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 class HtmlCardGroups extends HtmlViewGroups {
9 9
 
10 10
 	public function __construct($identifier, $cards=array()) {
11
-		parent::__construct($identifier, "ui cards",$cards);
11
+		parent::__construct($identifier, "ui cards", $cards);
12 12
 	}
13 13
 
14
-	protected function createElement(){
15
-		return new HtmlCard("card-" . $this->count());
14
+	protected function createElement() {
15
+		return new HtmlCard("card-".$this->count());
16 16
 	}
17 17
 
18 18
 	public function newItem($identifier) {
Please login to merge, or discard this patch.
Ajax/semantic/html/views/HtmlItems.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
 class HtmlItems extends HtmlViewGroups {
10 10
 
11 11
 	public function __construct($identifier, $items=[]) {
12
-		parent::__construct($identifier, "ui items",$items);
12
+		parent::__construct($identifier, "ui items", $items);
13 13
 	}
14 14
 
15
-	protected function createElement(){
16
-		return new HtmlItem("item-" . $this->count());
15
+	protected function createElement() {
16
+		return new HtmlItem("item-".$this->count());
17 17
 	}
18 18
 
19 19
 	public function newItem($identifier) {
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/ContentPartTrait.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
  * @author jc
7 7
  * @property mixed $content
8 8
  */
9
-trait ContentPartTrait{
10
-	public function addElementInPart($element,$partKey,$before=false,$force=false){
11
-		$part=$this->getPart($partKey,null,$force);
12
-		if($part instanceof  HtmlSemDoubleElement){
9
+trait ContentPartTrait {
10
+	public function addElementInPart($element, $partKey, $before=false, $force=false) {
11
+		$part=$this->getPart($partKey, null, $force);
12
+		if ($part instanceof  HtmlSemDoubleElement) {
13 13
 			$this->content[$partKey]=$part;
14
-			$part->addContent($element,$before);
14
+			$part->addContent($element, $before);
15 15
 		}
16 16
 		return $this;
17 17
 	}
18 18
 
19
-	public function getPart($partKey, $index=NULL,$force=false) {
19
+	public function getPart($partKey, $index=NULL, $force=false) {
20 20
 		if (\array_key_exists($partKey, $this->content)) {
21 21
 			if (isset($index))
22 22
 				return $this->content[$partKey][$index];
23 23
 			return $this->content[$partKey];
24 24
 		}
25
-		if($force){
26
-			return new HtmlSemDoubleElement($partKey."-".$this->identifier,"div",$partKey);
25
+		if ($force) {
26
+			return new HtmlSemDoubleElement($partKey."-".$this->identifier, "div", $partKey);
27 27
 		}
28 28
 		return NULL;
29 29
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@
 block discarded – undo
18 18
 
19 19
 	public function getPart($partKey, $index=NULL,$force=false) {
20 20
 		if (\array_key_exists($partKey, $this->content)) {
21
-			if (isset($index))
22
-				return $this->content[$partKey][$index];
21
+			if (isset($index)) {
22
+							return $this->content[$partKey][$index];
23
+			}
23 24
 			return $this->content[$partKey];
24 25
 		}
25 26
 		if($force){
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/HtmlViewItem.php 2 patches
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	public function __construct($identifier,$baseClass,$content=NULL) {
20 20
 		parent::__construct($identifier, "div", $baseClass);
21 21
 		$this->content=["content"=>new HtmlViewContent("content-".$this->identifier)];
22
-		if(isset($content))
23
-			$this->setContent($content);
22
+		if(isset($content)) {
23
+					$this->setContent($content);
24
+		}
24 25
 	}
25 26
 
26 27
 	public function setContent($value){
@@ -31,10 +32,12 @@  discard block
 block discarded – undo
31 32
 			if (isset($image)) {
32 33
 				$this->addImage($image);
33 34
 			}
34
-			if(isset($content))
35
-				$this->content["content"]->setContent($content);
36
-			if(isset($extra))
37
-				$this->addExtraContent($extra);
35
+			if(isset($content)) {
36
+							$this->content["content"]->setContent($content);
37
+			}
38
+			if(isset($extra)) {
39
+							$this->addExtraContent($extra);
40
+			}
38 41
 		}
39 42
 	}
40 43
 
@@ -49,10 +52,11 @@  discard block
 block discarded – undo
49 52
 		if (\array_key_exists($key, $this->content) === false) {
50 53
 			$this->content[$key]=[];
51 54
 		}
52
-		if($this->content[$key] instanceof HtmlViewContent)
53
-			$this->content[$key]->addElement($element);
54
-		else
55
-			$this->content[$key][]=$element;
55
+		if($this->content[$key] instanceof HtmlViewContent) {
56
+					$this->content[$key]->addElement($element);
57
+		} else {
58
+					$this->content[$key][]=$element;
59
+		}
56 60
 		return $element;
57 61
 	}
58 62
 
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
 		$this->addToProperty("class", "link");
154 158
 		if ($href !== "") {
155 159
 			$this->setProperty("href", $href);
156
-			if (isset($target))
157
-				$this->setProperty("target", $target);
160
+			if (isset($target)) {
161
+							$this->setProperty("target", $target);
162
+			}
158 163
 		}
159 164
 		return $this;
160 165
 	}
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 abstract class HtmlViewItem extends HtmlSemDoubleElement {
17 17
 	use ContentPartTrait;
18 18
 
19
-	public function __construct($identifier,$baseClass,$content=NULL) {
19
+	public function __construct($identifier, $baseClass, $content=NULL) {
20 20
 		parent::__construct($identifier, "div", $baseClass);
21 21
 		$this->content=["content"=>new HtmlViewContent("content-".$this->identifier)];
22
-		if(isset($content))
22
+		if (isset($content))
23 23
 			$this->setContent($content);
24 24
 	}
25 25
 
26
-	public function setContent($value){
26
+	public function setContent($value) {
27 27
 		if (\is_array($value)) {
28 28
 			$image=JArray::getValue($value, "image", 0);
29 29
 			$content=JArray::getValue($value, "content", 1);
@@ -31,57 +31,57 @@  discard block
 block discarded – undo
31 31
 			if (isset($image)) {
32 32
 				$this->addImage($image);
33 33
 			}
34
-			if(isset($content))
34
+			if (isset($content))
35 35
 				$this->content["content"]->setContent($content);
36
-			if(isset($extra))
36
+			if (isset($extra))
37 37
 				$this->addExtraContent($extra);
38 38
 		}
39 39
 	}
40 40
 
41 41
 	private function createContent($content, $baseClass="content") {
42 42
 		$count=\sizeof($this->content);
43
-		$result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content);
43
+		$result=new HtmlViewContent("content-".$count."-".$this->identifier, $content);
44 44
 		$result->setClass($baseClass);
45 45
 		return $result;
46 46
 	}
47 47
 
48 48
 	private function addElementIn($key, $element) {
49
-		if (\array_key_exists($key, $this->content) === false) {
49
+		if (\array_key_exists($key, $this->content)===false) {
50 50
 			$this->content[$key]=[];
51 51
 		}
52
-		if($this->content[$key] instanceof HtmlViewContent)
52
+		if ($this->content[$key] instanceof HtmlViewContent)
53 53
 			$this->content[$key]->addElement($element);
54 54
 		else
55 55
 			$this->content[$key][]=$element;
56 56
 		return $element;
57 57
 	}
58 58
 
59
-	public function addIcon($icon,$before=true){
60
-		return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon));
59
+	public function addIcon($icon, $before=true) {
60
+		return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon));
61 61
 	}
62 62
 
63 63
 
64 64
 	public function addHeader($header, $niveau=4, $type="page") {
65 65
 		if (!$header instanceof HtmlHeader) {
66
-			$header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type);
66
+			$header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type);
67 67
 		}
68
-		return $this->addElementIn("header",$this->createContent($header));
68
+		return $this->addElementIn("header", $this->createContent($header));
69 69
 	}
70 70
 
71 71
 	public function addImage($image, $title="") {
72 72
 		if (!$image instanceof HtmlImage) {
73
-			$image=new HtmlImage("image-" . $this->identifier, $image, $title);
73
+			$image=new HtmlImage("image-".$this->identifier, $image, $title);
74 74
 		}
75 75
 		$image->setClass("ui image");
76
-		return $this->content["image"]= $image;
76
+		return $this->content["image"]=$image;
77 77
 	}
78 78
 
79
-	public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") {
79
+	public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") {
80 80
 		$reveal=$visibleContent;
81 81
 		if (!$visibleContent instanceof HtmlReveal) {
82
-			$reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
82
+			$reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
83 83
 		}
84
-		return $this->content[$key]= $reveal;
84
+		return $this->content[$key]=$reveal;
85 85
 	}
86 86
 
87 87
 	public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) {
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 		if (!$visibleContent instanceof HtmlReveal) {
90 90
 			return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType);
91 91
 		}
92
-		return $this->content["image"]= $reveal;
92
+		return $this->content["image"]=$reveal;
93 93
 	}
94 94
 
95 95
 	public function addExtraContent($content=array()) {
96
-		return $this->content["extra-content"]= $this->createContent($content, "extra content");
96
+		return $this->content["extra-content"]=$this->createContent($content, "extra content");
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,23 +103,23 @@  discard block
 block discarded – undo
103 103
 	 * @param boolean $before
104 104
 	 * @return HtmlButtonGroups
105 105
 	 */
106
-	public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){
107
-		return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before);
106
+	public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) {
107
+		return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before);
108 108
 	}
109 109
 
110 110
 
111 111
 
112
-	public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) {
113
-		return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra);
112
+	public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) {
113
+		return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra);
114 114
 	}
115 115
 
116 116
 	public function addItemContent($content=array()) {
117 117
 		$count=\sizeof($this->content);
118
-		return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content));
118
+		return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content));
119 119
 	}
120 120
 
121 121
 	public function getItemContent() {
122
-		return $this->getPart("content",null,true);
122
+		return $this->getPart("content", null, true);
123 123
 	}
124 124
 
125 125
 	public function getItemExtraContent() {
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	 * @see HtmlSemDoubleElement::compile()
142 142
 	 */
143 143
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
144
-		$this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]);
144
+		$this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]);
145 145
 		return parent::compile($js, $view);
146 146
 	}
147 147
 
148
-	public function asLink($href="",$target=NULL) {
148
+	public function asLink($href="", $target=NULL) {
149 149
 		$this->addToProperty("class", "link");
150
-		if ($href !== "") {
150
+		if ($href!=="") {
151 151
 			$this->setProperty("href", $href);
152 152
 			if (isset($target))
153 153
 				$this->setProperty("target", $target);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 2 patches
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
 			$rules=$attributes["rules"];
65 65
 			if(\is_array($rules)){
66 66
 				$element->addRules($rules);
67
-			}
68
-			else{
67
+			} else{
69 68
 				$element->addRule($rules);
70 69
 			}
71 70
 			unset($attributes["rules"]);
@@ -117,8 +116,9 @@  discard block
 block discarded – undo
117 116
 	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
118 117
 		return $this->_fieldAs(function($id,$name,$value) use($icon){
119 118
 			$lbl=new HtmlLabel($id,$value);
120
-			if(isset($icon))
121
-				$lbl->addIcon($icon);
119
+			if(isset($icon)) {
120
+							$lbl->addIcon($icon);
121
+			}
122 122
 				return $lbl;
123 123
 		}, $index,$attributes,"label");
124 124
 	}
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
127 127
 		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
128 128
 			$header=new HtmlHeader($id,$niveau,$value);
129
-			if(isset($icon))
130
-				$header->asIcon($icon, $value);
129
+			if(isset($icon)) {
130
+							$header->asIcon($icon, $value);
131
+			}
131 132
 			return $header;
132 133
 		}, $index,$attributes,"header");
133 134
 	}
@@ -135,7 +136,9 @@  discard block
 block discarded – undo
135 136
 
136 137
 	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
137 138
 		$this->setValueFunction($index,function($img) use($size,$circular){
138
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
139
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
140
+				$image->setCircular();
141
+			}
139 142
 			return $image;
140 143
 		});
141 144
 			return $this;
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
 
195 198
 	public function fieldAsCheckbox($index,$attributes=NULL){
196 199
 		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
197
-			if($caption===null || $caption==="")
198
-				$caption="";
200
+			if($caption===null || $caption==="") {
201
+							$caption="";
202
+			}
199 203
 			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
200 204
 			$input->setChecked(JString::isBooleanTrue($value));
201 205
 			return $this->_prepareFormFields($input, $name, $attributes);
@@ -232,14 +236,14 @@  discard block
 block discarded – undo
232 236
 		$i=0;
233 237
 		if(JArray::isAssociative($types)){
234 238
 			foreach ($types as $type=>$attributes){
235
-				if(\is_int($type))
236
-					$this->fieldAs($i++,$attributes,[]);
237
-				else{
239
+				if(\is_int($type)) {
240
+									$this->fieldAs($i++,$attributes,[]);
241
+				} else{
238 242
 					$type=preg_replace('/\d/', '', $type );
239 243
 					$this->fieldAs($i++,$type,$attributes);
240 244
 				}
241 245
 			}
242
-		}else{
246
+		} else{
243 247
 			foreach ($types as $type){
244 248
 				$this->fieldAs($i++,$type);
245 249
 			}
@@ -251,7 +255,7 @@  discard block
 block discarded – undo
251 255
 		if(\method_exists($this, $method)){
252 256
 			if(!\is_array($attributes)){
253 257
 				$attributes=[$index];
254
-			}else{
258
+			} else{
255 259
 				\array_unshift($attributes, $index);
256 260
 			}
257 261
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
  * @property mixed $_modelInstance
33 33
  * @property boolean $_hasRules
34 34
  */
35
-trait FieldAsTrait{
35
+trait FieldAsTrait {
36 36
 
37
-	abstract protected function _getFieldIdentifier($prefix,$name="");
38
-	abstract public function setValueFunction($index,$callback);
37
+	abstract protected function _getFieldIdentifier($prefix, $name="");
38
+	abstract public function setValueFunction($index, $callback);
39 39
 	abstract protected function _getFieldName($index);
40 40
 	abstract protected function _getFieldCaption($index);
41
-	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
41
+	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL);
42 42
 
43 43
 	/**
44 44
 	 * @param HtmlFormField $element
45 45
 	 * @param array $attributes
46 46
 	 */
47
-	protected function _applyAttributes(BaseHtml $element,&$attributes,$index,$instance=null){
48
-		if(isset($attributes["jsCallback"])){
47
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
48
+		if (isset($attributes["jsCallback"])) {
49 49
 			$callback=$attributes["jsCallback"];
50
-			if(\is_callable($callback)){
51
-				$callback($element,$instance,$index,InstanceViewer::$index);
50
+			if (\is_callable($callback)) {
51
+				$callback($element, $instance, $index, InstanceViewer::$index);
52 52
 			}
53 53
 		}
54 54
 		unset($attributes["rules"]);
@@ -57,44 +57,44 @@  discard block
 block discarded – undo
57 57
 		$element->fromArray($attributes);
58 58
 	}
59 59
 
60
-	private function _getLabelField($caption,$icon=NULL){
61
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
60
+	private function _getLabelField($caption, $icon=NULL) {
61
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
62 62
 		return $label;
63 63
 	}
64 64
 
65 65
 
66
-	protected function _addRules(HtmlFormField $element,&$attributes){
67
-		if(isset($attributes["rules"])){
66
+	protected function _addRules(HtmlFormField $element, &$attributes) {
67
+		if (isset($attributes["rules"])) {
68 68
 			$this->_hasRules=true;
69 69
 			$rules=$attributes["rules"];
70
-			if(\is_array($rules)){
70
+			if (\is_array($rules)) {
71 71
 				$element->addRules($rules);
72 72
 			}
73
-			else{
73
+			else {
74 74
 				$element->addRule($rules);
75 75
 			}
76 76
 			unset($attributes["rules"]);
77 77
 		}
78 78
 	}
79 79
 
80
-	protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){
80
+	protected function _prepareFormFields(HtmlFormField &$field, $name, &$attributes) {
81 81
 		$field->setName($name);
82 82
 		$this->_addRules($field, $attributes);
83 83
 		return $field;
84 84
 	}
85 85
 
86
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
87
-		$this->setValueFunction($index,function($value,$instance,$index,$rowIndex) use (&$attributes,$elementCallback,$prefix){
86
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
87
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix){
88 88
 			$caption=$this->_getFieldCaption($index);
89 89
 			$name=$this->_getFieldName($index);
90
-			$id=$this->_getFieldIdentifier($prefix,$name);
91
-			if(isset($attributes["name"])){
90
+			$id=$this->_getFieldIdentifier($prefix, $name);
91
+			if (isset($attributes["name"])) {
92 92
 				$name=$attributes["name"];
93 93
 				unset($attributes["name"]);
94 94
 			}
95
-			$element=$elementCallback($id,$name,$value,$caption);
96
-			if(\is_array($attributes)){
97
-				$this->_applyAttributes($element, $attributes,$index,$instance);
95
+			$element=$elementCallback($id, $name, $value, $caption);
96
+			if (\is_array($attributes)) {
97
+				$this->_applyAttributes($element, $attributes, $index, $instance);
98 98
 			}
99 99
 			$element->setDisabled(!$this->_edition);
100 100
 			return $element;
@@ -103,205 +103,205 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 
106
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
107
-		$this->setValueFunction($index,function($value) use($label,$attributes){
108
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
106
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
107
+		$this->setValueFunction($index, function($value) use($label, $attributes){
108
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
109 109
 			return $pb;
110 110
 		});
111 111
 			return $this;
112 112
 	}
113 113
 
114
-	public function fieldAsRating($index,$max=5, $icon=""){
115
-		$this->setValueFunction($index,function($value) use($max,$icon){
116
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
114
+	public function fieldAsRating($index, $max=5, $icon="") {
115
+		$this->setValueFunction($index, function($value) use($max, $icon){
116
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
117 117
 			return $rating;
118 118
 		});
119 119
 			return $this;
120 120
 	}
121 121
 
122
-	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
123
-		return $this->_fieldAs(function($id,$name,$value) use($icon){
124
-			$lbl=new HtmlLabel($id,$value);
125
-			if(isset($icon))
122
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
123
+		return $this->_fieldAs(function($id, $name, $value) use($icon){
124
+			$lbl=new HtmlLabel($id, $value);
125
+			if (isset($icon))
126 126
 				$lbl->addIcon($icon);
127 127
 				return $lbl;
128
-		}, $index,$attributes,"label");
128
+		}, $index, $attributes, "label");
129 129
 	}
130 130
 
131
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
132
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
133
-			$header=new HtmlHeader($id,$niveau,$value);
134
-			if(isset($icon))
131
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
132
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
133
+			$header=new HtmlHeader($id, $niveau, $value);
134
+			if (isset($icon))
135 135
 				$header->asIcon($icon, $value);
136 136
 			return $header;
137
-		}, $index,$attributes,"header");
137
+		}, $index, $attributes, "header");
138 138
 	}
139 139
 
140 140
 
141
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
142
-		$this->setValueFunction($index,function($img) use($size,$circular){
143
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
141
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
142
+		$this->setValueFunction($index, function($img) use($size, $circular){
143
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
144 144
 			return $image;
145 145
 		});
146 146
 			return $this;
147 147
 	}
148 148
 
149
-	public function fieldAsFlag($index){
150
-		$this->setValueFunction($index,function($flag){
151
-			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag);
149
+	public function fieldAsFlag($index) {
150
+		$this->setValueFunction($index, function($flag) {
151
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
152 152
 			return $flag;
153 153
 		});
154 154
 			return $this;
155 155
 	}
156 156
 
157
-	public function fieldAsIcon($index){
158
-		$this->setValueFunction($index,function($icon){
159
-			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"),$icon);
157
+	public function fieldAsIcon($index) {
158
+		$this->setValueFunction($index, function($icon) {
159
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
160 160
 			return $icon;
161 161
 		});
162 162
 			return $this;
163 163
 	}
164 164
 
165
-	public function fieldAsAvatar($index,$attributes=NULL){
166
-		return $this->_fieldAs(function($id,$name,$value){
167
-			$img=new HtmlImage($id,$value);
165
+	public function fieldAsAvatar($index, $attributes=NULL) {
166
+		return $this->_fieldAs(function($id, $name, $value) {
167
+			$img=new HtmlImage($id, $value);
168 168
 			$img->asAvatar();
169 169
 			return $img;
170
-		}, $index,$attributes,"avatar");
170
+		}, $index, $attributes, "avatar");
171 171
 	}
172 172
 
173
-	public function fieldAsRadio($index,$attributes=NULL){
174
-		return $this->_fieldAs(function($id,$name,$value) use($attributes){
175
-			$input= new HtmlFormRadio($id,$name,$value,$value);
173
+	public function fieldAsRadio($index, $attributes=NULL) {
174
+		return $this->_fieldAs(function($id, $name, $value) use($attributes){
175
+			$input=new HtmlFormRadio($id, $name, $value, $value);
176 176
 			return $this->_prepareFormFields($input, $name, $attributes);
177
-		}, $index,$attributes,"radio");
177
+		}, $index, $attributes, "radio");
178 178
 	}
179 179
 
180
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
181
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
182
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
183
-		}, $index,$attributes,"radios");
180
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
181
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
182
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
183
+		}, $index, $attributes, "radios");
184 184
 	}
185 185
 	
186
-	public function fieldAsList($index,$classNames="",$attributes=NULL){
187
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($classNames){
188
-			$result= new HtmlList($name,$value);
186
+	public function fieldAsList($index, $classNames="", $attributes=NULL) {
187
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($classNames){
188
+			$result=new HtmlList($name, $value);
189 189
 			$result->addClass($classNames);
190 190
 			return $result;
191
-		}, $index,$attributes,"list");
191
+		}, $index, $attributes, "list");
192 192
 	}
193 193
 
194
-	public function fieldAsInput($index,$attributes=NULL){
195
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
196
-			$input= new HtmlFormInput($id,$caption,"text",$value);
194
+	public function fieldAsInput($index, $attributes=NULL) {
195
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
196
+			$input=new HtmlFormInput($id, $caption, "text", $value);
197 197
 			return $this->_prepareFormFields($input, $name, $attributes);
198
-		}, $index,$attributes,"input");
198
+		}, $index, $attributes, "input");
199 199
 	}
200 200
 
201
-	public function fieldAsTextarea($index,$attributes=NULL){
202
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
203
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
201
+	public function fieldAsTextarea($index, $attributes=NULL) {
202
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
203
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
204 204
 			return $this->_prepareFormFields($textarea, $name, $attributes);
205
-		}, $index,$attributes,"textarea");
205
+		}, $index, $attributes, "textarea");
206 206
 	}
207 207
 
208
-	public function fieldAsElement($index,$tagName="div",$baseClass="",$attributes=NULL){
209
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes,$tagName,$baseClass){
210
-			$div=new HtmlSemDoubleElement($id,$tagName,$baseClass);
208
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
209
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass){
210
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
211 211
 			$div->setContent(\htmlentities($value));
212
-			$textarea=new HtmlFormField("field-".$id, $div,$caption);
212
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
213 213
 			return $this->_prepareFormFields($textarea, $name, $attributes);
214
-		}, $index,$attributes,"element");
214
+		}, $index, $attributes, "element");
215 215
 	}
216 216
 
217 217
 
218
-	public function fieldAsHidden($index,$attributes=NULL){
219
-		if(!\is_array($attributes)){
218
+	public function fieldAsHidden($index, $attributes=NULL) {
219
+		if (!\is_array($attributes)) {
220 220
 			$attributes=[];
221 221
 		}
222 222
 		$attributes["inputType"]="hidden";
223 223
 		$attributes["style"]="display:none;";
224
-		return $this->fieldAsInput($index,$attributes);
224
+		return $this->fieldAsInput($index, $attributes);
225 225
 	}
226 226
 
227
-	public function fieldAsCheckbox($index,$attributes=NULL){
228
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
229
-			if($caption===null || $caption==="")
227
+	public function fieldAsCheckbox($index, $attributes=NULL) {
228
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){
229
+			if ($caption===null || $caption==="")
230 230
 				$caption="";
231
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
231
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
232 232
 			$input->setChecked(JString::isBooleanTrue($value));
233 233
 			return $this->_prepareFormFields($input, $name, $attributes);
234
-		}, $index,$attributes,"ck");
234
+		}, $index, $attributes, "ck");
235 235
 	}
236 236
 
237
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
238
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){
239
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
240
-			$dd->asSelect($name,$multiple);
237
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
238
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){
239
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
240
+			$dd->asSelect($name, $multiple);
241 241
 			return $this->_prepareFormFields($dd, $name, $attributes);
242
-		}, $index,$attributes,"dd");
242
+		}, $index, $attributes, "dd");
243 243
 	}
244 244
 
245
-	public function fieldAsMessage($index,$attributes=NULL){
246
-		return $this->_fieldAs(function($id,$name,$value,$caption){
247
-			$mess= new HtmlMessage("message-".$id,$caption);
245
+	public function fieldAsMessage($index, $attributes=NULL) {
246
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
247
+			$mess=new HtmlMessage("message-".$id, $caption);
248 248
 			$mess->addHeader($value);
249 249
 			return $mess;
250
-		}, $index,$attributes,"message");
250
+		}, $index, $attributes, "message");
251 251
 	}
252 252
 
253
-	public function fieldAsLink($index,$attributes=NULL){
254
-		return $this->_fieldAs(function($id,$name,$value,$caption){
255
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
253
+	public function fieldAsLink($index, $attributes=NULL) {
254
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
255
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
256 256
 			return $lnk;
257
-		}, $index,$attributes,"link");
257
+		}, $index, $attributes, "link");
258 258
 	}
259 259
 
260 260
 	/**Change fields type
261 261
 	 * @param array $types an array or associative array $type=>$attributes
262 262
 	 */
263
-	public function fieldsAs(array $types){
263
+	public function fieldsAs(array $types) {
264 264
 		$i=0;
265
-		if(JArray::isAssociative($types)){
266
-			foreach ($types as $type=>$attributes){
267
-				if(\is_int($type))
268
-					$this->fieldAs($i++,$attributes,[]);
269
-				else{
270
-					$type=preg_replace('/\d/', '', $type );
271
-					$this->fieldAs($i++,$type,$attributes);
265
+		if (JArray::isAssociative($types)) {
266
+			foreach ($types as $type=>$attributes) {
267
+				if (\is_int($type))
268
+					$this->fieldAs($i++, $attributes, []);
269
+				else {
270
+					$type=preg_replace('/\d/', '', $type);
271
+					$this->fieldAs($i++, $type, $attributes);
272 272
 				}
273 273
 			}
274
-		}else{
275
-			foreach ($types as $type){
276
-				$this->fieldAs($i++,$type);
274
+		} else {
275
+			foreach ($types as $type) {
276
+				$this->fieldAs($i++, $type);
277 277
 			}
278 278
 		}
279 279
 	}
280 280
 
281
-	public function fieldAs($index,$type,$attributes=NULL){
281
+	public function fieldAs($index, $type, $attributes=NULL) {
282 282
 		$method="fieldAs".\ucfirst($type);
283
-		if(\method_exists($this, $method)){
284
-			if(!\is_array($attributes)){
283
+		if (\method_exists($this, $method)) {
284
+			if (!\is_array($attributes)) {
285 285
 				$attributes=[$index];
286
-			}else{
286
+			} else {
287 287
 				\array_unshift($attributes, $index);
288 288
 			}
289
-			\call_user_func_array([$this,$method], $attributes);
289
+			\call_user_func_array([$this, $method], $attributes);
290 290
 		}
291 291
 	}
292 292
 
293
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
294
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
295
-			$button=new HtmlButton($id,$caption,$cssStyle);
296
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
293
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
294
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
295
+			$button=new HtmlButton($id, $caption, $cssStyle);
296
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
297 297
 			return $button;
298
-		}, $index,$attributes,"submit");
298
+		}, $index, $attributes, "submit");
299 299
 	}
300 300
 
301
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
302
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
303
-			$button=new HtmlButton($id,$value,$cssStyle);
301
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
302
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
303
+			$button=new HtmlButton($id, $value, $cssStyle);
304 304
 			return $button;
305
-		}, $index,$attributes,"button");
305
+		}, $index, $attributes, "button");
306 306
 	}
307 307
 }
Please login to merge, or discard this patch.