Passed
Push — master ( e33ab3...35deb2 )
by Jean-Christophe
02:27
created
Ajax/semantic/html/modules/checkbox/AbstractCheckbox.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 		$field->setProperty("name", $name);
17 17
 		$this->setField($field);
18 18
 		if (isset($label))
19
-			$this->setLabel($label,$value);
19
+			$this->setLabel($label, $value);
20 20
 	}
21 21
 
22
-	public function setChecked($value=true){
23
-		if($value===true){
22
+	public function setChecked($value=true) {
23
+		if ($value===true) {
24 24
 			$this->getField()->setProperty("checked", "checked");
25
-		}else{
25
+		} else {
26 26
 			$this->getField()->removeProperty("checked");
27 27
 		}
28 28
 		return $this;
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants());
33 33
 	}
34 34
 
35
-	public function setLabel($label,$value=null) {
35
+	public function setLabel($label, $value=null) {
36 36
 		$labelO=$label;
37 37
 		if (\is_string($label)) {
38 38
 			$labelO=new HtmlSemDoubleElement("", "label", "");
39 39
 			$labelO->setContent($label);
40 40
 			$labelO->setProperty("for", $this->getField()->getIdentifier());
41
-			if(isset($value))
41
+			if (isset($value))
42 42
 				$labelO->setProperty("data-value", $value);
43 43
 		}
44 44
 		$this->content["label"]=$labelO;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return AbstractCheckbox
87 87
 	 */
88 88
 	public function attachEvent($selector, $action=NULL) {
89
-		if (isset($action)||\is_numeric($action)===true) {
89
+		if (isset($action) || \is_numeric($action)===true) {
90 90
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");';
91 91
 		} else {
92 92
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'");';
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function attachEvents($events=array()) {
104 104
 		if (\is_array($events)) {
105
-			foreach ( $events as $action => $selector ) {
105
+			foreach ($events as $action => $selector) {
106 106
 				$this->attachEvent($selector, $action);
107 107
 			}
108 108
 		}
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 		return $this->addToProperty("class", "fitted");
114 114
 	}
115 115
 
116
-	public function setOnChecked($jsCode){
116
+	public function setOnChecked($jsCode) {
117 117
 		$this->_params["onChecked"]=$jsCode;
118 118
 		return $this;
119 119
 	}
120 120
 
121
-	public function setOnUnchecked($jsCode){
121
+	public function setOnUnchecked($jsCode) {
122 122
 		$this->_params["onUnchecked"]=$jsCode;
123 123
 		return $this;
124 124
 	}
125 125
 
126
-	public function setOnChange($jsCode){
126
+	public function setOnChange($jsCode) {
127 127
 		$this->_params["onChange"]=$jsCode;
128 128
 		return $this;
129 129
 	}
130 130
 
131 131
 	public function run(JsUtils $js) {
132
-		if(!isset($this->_bsComponent))
133
-			$this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params);
132
+		if (!isset($this->_bsComponent))
133
+			$this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params);
134 134
 		return parent::run($js);
135 135
 	}
136 136
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlShape.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 use Ajax\common\html\BaseHtml;
9 9
 
10 10
 
11
-class HtmlShape extends HtmlSemCollection{
11
+class HtmlShape extends HtmlSemCollection {
12 12
 
13 13
 	protected $_params=array();
14 14
 	protected $_autoActive=true;
15 15
 
16
-	public function __construct( $identifier, $sides){
17
-		parent::__construct( $identifier, "div", "ui shape");
16
+	public function __construct($identifier, $sides) {
17
+		parent::__construct($identifier, "div", "ui shape");
18 18
 		$this->_template='<%tagName% id="%identifier%" %properties%><div class="sides">%wrapContentBefore%%content%%wrapContentAfter%</div></%tagName%>';
19 19
 		$this->addItems($sides);
20 20
 	}
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * {@inheritDoc}
24 24
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
25 25
 	 */
26
-	protected function createItem($value){
27
-		if(\is_object($value)===false){
28
-			$value=new HtmlSemDoubleElement("","div","content",$value);
26
+	protected function createItem($value) {
27
+		if (\is_object($value)===false) {
28
+			$value=new HtmlSemDoubleElement("", "div", "content", $value);
29 29
 		}
30 30
 		return new HtmlShapeItem("side-".$this->identifier."-".$this->count(), $value);
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * {@inheritDoc}
35 35
 	 * @see \Ajax\common\html\HtmlCollection::createCondition()
36 36
 	 */
37
-	protected function createCondition($value){
37
+	protected function createCondition($value) {
38 38
 		return ($value instanceof HtmlShapeItem)===false;
39 39
 	}
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param int $index
43 43
 	 * @return \Ajax\semantic\html\content\HtmlShapeItem
44 44
 	 */
45
-	public function getSide($index){
45
+	public function getSide($index) {
46 46
 		return $this->getItem($index);
47 47
 	}
48 48
 
@@ -50,96 +50,96 @@  discard block
 block discarded – undo
50 50
 	 * @param int $index
51 51
 	 * @return mixed|NULL
52 52
 	 */
53
-	public function getSideContent($index){
54
-		$item= $this->getItem($index);
55
-		if(isset($item))
53
+	public function getSideContent($index) {
54
+		$item=$this->getItem($index);
55
+		if (isset($item))
56 56
 			return $item->getContent();
57 57
 		return null;
58 58
 	}
59 59
 
60
-	public function jsDo($action){
60
+	public function jsDo($action) {
61 61
 		return "$('#".$this->identifier."').shape('".$action."');";
62 62
 	}
63 63
 
64
-	public function jsFlipLeft(){
64
+	public function jsFlipLeft() {
65 65
 		return $this->jsDo("flip left");
66 66
 	}
67 67
 
68
-	public function jsFlipRight(){
68
+	public function jsFlipRight() {
69 69
 		return $this->jsDo("flip right");
70 70
 	}
71 71
 
72
-	public function jsFlipUp(){
72
+	public function jsFlipUp() {
73 73
 		return $this->jsDo("flip up");
74 74
 	}
75 75
 
76
-	public function jsFlipDown(){
76
+	public function jsFlipDown() {
77 77
 		return $this->jsDo("flip down");
78 78
 	}
79 79
 
80
-	public function jsFlipOver(){
80
+	public function jsFlipOver() {
81 81
 		return $this->jsDo("flip over");
82 82
 	}
83 83
 
84
-	public function jsFlipBack(){
84
+	public function jsFlipBack() {
85 85
 		return $this->jsDo("flip back");
86 86
 	}
87 87
 
88
-	private function doActionOn($element,$event,$what){
89
-		if($element instanceof BaseHtml){
90
-			return $element->on($event, $what,true,true);
88
+	private function doActionOn($element, $event, $what) {
89
+		if ($element instanceof BaseHtml) {
90
+			return $element->on($event, $what, true, true);
91 91
 		}
92 92
 	}
93 93
 
94
-	public function flipLeftOn($element,$event){
94
+	public function flipLeftOn($element, $event) {
95 95
 		return $this->doActionOn($element, $event, $this->jsFlipLeft());
96 96
 	}
97 97
 
98
-	public function flipRightOn($element,$event){
98
+	public function flipRightOn($element, $event) {
99 99
 		return $this->doActionOn($element, $event, $this->jsFlipRight());
100 100
 	}
101 101
 
102
-	public function flipUpOn($element,$event){
102
+	public function flipUpOn($element, $event) {
103 103
 		return $this->doActionOn($element, $event, $this->jsFlipUp());
104 104
 	}
105 105
 
106
-	public function flipDownOn($element,$event){
106
+	public function flipDownOn($element, $event) {
107 107
 		return $this->doActionOn($element, $event, $this->jsFlipDown());
108 108
 	}
109 109
 
110
-	public function flipBackOn($element,$event){
110
+	public function flipBackOn($element, $event) {
111 111
 		return $this->doActionOn($element, $event, $this->jsFlipBack());
112 112
 	}
113 113
 
114
-	public function flipOverOn($element,$event){
114
+	public function flipOverOn($element, $event) {
115 115
 		return $this->doActionOn($element, $event, $this->jsFlipOver());
116 116
 	}
117 117
 
118
-	public function setActiveSide($index){
118
+	public function setActiveSide($index) {
119 119
 		$side=$this->getSide($index);
120
-		if(isset($side)){
120
+		if (isset($side)) {
121 121
 			$side->setActive(true);
122 122
 		}
123 123
 		return $this;
124 124
 	}
125 125
 
126
-	public function asCube(){
126
+	public function asCube() {
127 127
 		return $this->addToPropertyCtrl("class", "cube", ["cube"]);
128 128
 	}
129 129
 
130
-	public function asText(){
130
+	public function asText() {
131 131
 		return $this->addToPropertyCtrl("class", "text", ["text"]);
132 132
 	}
133 133
 
134
-	public function setWidth($width="initial"){
134
+	public function setWidth($width="initial") {
135 135
 		$this->_params["width"]=$width;
136 136
 	}
137
-	public function onChange($jsCode){
138
-		return $this->_params["onChange"]="%function(){" . $jsCode . "}%";
137
+	public function onChange($jsCode) {
138
+		return $this->_params["onChange"]="%function(){".$jsCode."}%";
139 139
 	}
140 140
 
141
-	public function beforeChange($jsCode){
142
-		return $this->_params["beforeChange"]="%function(){" . $jsCode . "}%";
141
+	public function beforeChange($jsCode) {
142
+		return $this->_params["beforeChange"]="%function(){".$jsCode."}%";
143 143
 	}
144 144
 
145 145
 	/*
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 * @see BaseHtml::run()
148 148
 	 */
149 149
 	public function run(JsUtils $js) {
150
-		if (isset($this->_bsComponent) === false)
151
-			$this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params);
150
+		if (isset($this->_bsComponent)===false)
151
+			$this->_bsComponent=$js->semantic()->shape("#".$this->identifier, $this->_params);
152 152
 		$this->addEventsOnRun($js);
153 153
 		return $this->_bsComponent;
154 154
 	}
155 155
 
156 156
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
157
-		if($this->_autoActive)
157
+		if ($this->_autoActive)
158 158
 			$this->setActiveSide(0);
159
-		return parent::compile($js,$view);
159
+		return parent::compile($js, $view);
160 160
 	}
161 161
 }
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 array $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/semantic/html/modules/HtmlTab.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
  * @author jc
16 16
  * @version 1.001
17 17
  */
18
-class HtmlTab extends HtmlSemCollection{
18
+class HtmlTab extends HtmlSemCollection {
19 19
 
20 20
 	protected $params=[];
21 21
 
22
-	public function __construct( $identifier, $tabs=array()){
23
-		parent::__construct( $identifier, "div", "");
22
+	public function __construct($identifier, $tabs=array()) {
23
+		parent::__construct($identifier, "div", "");
24 24
 		$menu=new HtmlMenu("menu".$this->identifier);
25
-		$menu->asTab(false)->setAttachment(NULL,Side::TOP);
25
+		$menu->asTab(false)->setAttachment(NULL, Side::TOP);
26 26
 		$this->content["menu"]=$menu;
27 27
 		$this->addItems($tabs);
28 28
 	}
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
33 33
 	 * @return HtmlSegment
34 34
 	 */
35
-	protected function createItem($value){
35
+	protected function createItem($value) {
36 36
 		$count=$this->count();
37 37
 		$title=$value;
38 38
 		$content=NULL;
39
-		if(\is_array($value)){
40
-			$title=@$value[0];$content=@$value[1];
39
+		if (\is_array($value)) {
40
+			$title=@$value[0]; $content=@$value[1];
41 41
 		}
42 42
 		$menuItem=$this->content["menu"]->addItem($title);
43 43
 		$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param string $datatab
54 54
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
55 55
 	 */
56
-	private function createSegment($count,$content,$datatab){
56
+	private function createSegment($count, $content, $datatab) {
57 57
 		$segment=new HtmlSegment("item-".$this->identifier."-".$count, $content);
58
-		$segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab);
58
+		$segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab);
59 59
 		return $segment;
60 60
 	}
61 61
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 * @param String $content new content
66 66
 	 * @return \Ajax\semantic\html\modules\HtmlTab
67 67
 	 */
68
-	public function setTabContent($index,$content){
68
+	public function setTabContent($index, $content) {
69 69
 		$menu=$this->content["menu"];
70
-		if($index<$menu->count()){
71
-			if(isset($this->content[$index])===false){
70
+		if ($index<$menu->count()) {
71
+			if (isset($this->content[$index])===false) {
72 72
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
73
-			}else
73
+			} else
74 74
 				$this->content[$index]->setContent($content);
75 75
 		}
76 76
 		return $this;
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param array $contents
82 82
 	 * @return \Ajax\semantic\html\modules\HtmlTab
83 83
 	 */
84
-	public function setTabsContent($contents){
84
+	public function setTabsContent($contents) {
85 85
 		$size=\sizeof($contents);
86
-		for($i=0;$i<$size;$i++){
86
+		for ($i=0; $i<$size; $i++) {
87 87
 			$this->setTabContent($i, $contents[$i]);
88 88
 		}
89 89
 		return $this;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param int $index
95 95
 	 * @return \Ajax\semantic\html\modules\HtmlTab
96 96
 	 */
97
-	public function activate($index){
97
+	public function activate($index) {
98 98
 		$this->content["menu"]->getItem($index)->setActive(true);
99 99
 		$this->content[$index]->setActive(true);
100 100
 		return $this;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param string $content
107 107
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
108 108
 	 */
109
-	public function addTab($title,$content){
110
-		return $this->addItem([$title,$content]);
109
+	public function addTab($title, $content) {
110
+		return $this->addItem([$title, $content]);
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 * @param array $params
122 122
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
123 123
 	 */
124
-	public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
125
-		if(\array_key_exists($index, $this->content)){
126
-			$this->content[$index]=$js->forward($initialController, $controller, $action,$params);
124
+	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
125
+		if (\array_key_exists($index, $this->content)) {
126
+			$this->content[$index]=$js->forward($initialController, $controller, $action, $params);
127 127
 			return $this->content[$index];
128 128
 		}
129 129
 
130
-		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params);
130
+		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params);
131 131
 	}
132 132
 
133 133
 	/**
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @param array $params The parameters to pass to the view
141 141
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
142 142
 	 */
143
-	public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) {
144
-		if(\array_key_exists($index, $this->content)){
145
-			$this->content[$index]=$js->renderContent($initialController, $viewName,$params);
143
+	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) {
144
+		if (\array_key_exists($index, $this->content)) {
145
+			$this->content[$index]=$js->renderContent($initialController, $viewName, $params);
146 146
 			return $this->content[$index];
147 147
 		}
148
-		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params);
148
+		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params);
149 149
 	}
150 150
 
151 151
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 * @param array $params
160 160
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
161 161
 	 */
162
-	public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
162
+	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
163 163
 		\ob_start();
164
-		$js->forward($initialController, $controller, $action,$params);
164
+		$js->forward($initialController, $controller, $action, $params);
165 165
 		$content=\ob_get_clean();
166
-		return $this->addTab($title,$content);
166
+		return $this->addTab($title, $content);
167 167
 	}
168 168
 
169 169
 	/**
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @param array $params The parameters to pass to the view
176 176
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
177 177
 	 */
178
-	public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
179
-		return $this->addTab($title, $js->renderContent($initialController, $viewName,$params));
178
+	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
179
+		return $this->addTab($title, $js->renderContent($initialController, $viewName, $params));
180 180
 	}
181 181
 
182 182
 	public function setPointing($value=Direction::NONE) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param int $index
193 193
 	 * @return HtmlMenuItem
194 194
 	 */
195
-	public function getMenuTab($index){
195
+	public function getMenuTab($index) {
196 196
 		return $this->content["menu"]->getItem($index);
197 197
 	}
198 198
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param int $index
202 202
 	 * @return HtmlSegment
203 203
 	 */
204
-	public function getTab($index){
204
+	public function getTab($index) {
205 205
 		return $this->content[$index];
206 206
 	}
207 207
 
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
 	 * @param HtmlMenu $menu
211 211
 	 * @return \Ajax\semantic\html\modules\HtmlTab
212 212
 	 */
213
-	public function setMenu($menu){
213
+	public function setMenu($menu) {
214 214
 		$contentSize=\sizeof($this->content);
215
-		for($i=0;$i<$contentSize;$i++){
216
-			if($menu->getItem($i)!==NULL){
217
-				if(isset($this->content[$i])){
218
-					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
215
+		for ($i=0; $i<$contentSize; $i++) {
216
+			if ($menu->getItem($i)!==NULL) {
217
+				if (isset($this->content[$i])) {
218
+					$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
219 219
 				}
220 220
 			}
221 221
 		}
222 222
 		$menuSize=$menu->count();
223
-		for($i=0;$i<$menuSize;$i++){
223
+		for ($i=0; $i<$menuSize; $i++) {
224 224
 			$menu->getItem($i)->removeProperty("href");
225
-			if(isset($this->content[$i])===false){
225
+			if (isset($this->content[$i])===false) {
226 226
 				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
227 227
 			}
228
-			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
228
+			$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
229 229
 		}
230 230
 
231 231
 		$this->content["menu"]=$menu;
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 	 * @see BaseHtml::run()
238 238
 	 */
239 239
 	public function run(JsUtils $js) {
240
-		if(isset($this->_bsComponent)===false)
241
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
240
+		if (isset($this->_bsComponent)===false)
241
+			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params);
242 242
 			$this->addEventsOnRun($js);
243 243
 			return $this->_bsComponent;
244 244
 	}
245 245
 
246 246
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
247
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
247
+		if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
248 248
 			$this->activate(0);
249
-		return parent::compile($js,$view);
249
+		return parent::compile($js, $view);
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlAccordion.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@  discard block
 block discarded – undo
6 6
 use Ajax\semantic\html\content\HtmlAccordionItem;
7 7
 use Ajax\JsUtils;
8 8
 
9
-class HtmlAccordion extends HtmlSemCollection{
9
+class HtmlAccordion extends HtmlSemCollection {
10 10
 
11 11
 	protected $params=array();
12 12
 
13
-	public function __construct( $identifier, $tagName="div", $baseClass="ui"){
14
-		parent::__construct( $identifier, "div", "ui accordion");
13
+	public function __construct($identifier, $tagName="div", $baseClass="ui") {
14
+		parent::__construct($identifier, "div", "ui accordion");
15 15
 	}
16 16
 
17 17
 
18
-	protected function createItem($value){
18
+	protected function createItem($value) {
19 19
 		$count=$this->count();
20 20
 		$title=$value;
21 21
 		$content=NULL;
22
-		if(\is_array($value)){
23
-			$title=@$value[0];$content=@$value[1];
22
+		if (\is_array($value)) {
23
+			$title=@$value[0]; $content=@$value[1];
24 24
 		}
25
-		return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content);
25
+		return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content);
26 26
 	}
27 27
 
28
-	protected function createCondition($value){
28
+	protected function createCondition($value) {
29 29
 		return ($value instanceof HtmlAccordionItem)===false;
30 30
 	}
31 31
 
32
-	public function addPanel($title,$content){
33
-		return $this->addItem([$title,$content]);
32
+	public function addPanel($title, $content) {
33
+		return $this->addItem([$title, $content]);
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param string $action a Phalcon action
43 43
 	 * @param array $params
44 44
 	 */
45
-	public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
46
-		return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params));
45
+	public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
46
+		return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params));
47 47
 	}
48 48
 
49 49
 	/**
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	 * @param string $viewName
55 55
 	 * @param array $params The parameters to pass to the view
56 56
 	 */
57
-	public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
58
-		return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params));
57
+	public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
58
+		return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params));
59 59
 	}
60 60
 	/*
61 61
 	 * (non-PHPdoc)
62 62
 	 * @see BaseHtml::run()
63 63
 	 */
64 64
 	public function run(JsUtils $js) {
65
-		if(isset($this->_bsComponent)===false)
66
-			$this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params);
65
+		if (isset($this->_bsComponent)===false)
66
+			$this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params);
67 67
 			$this->addEventsOnRun($js);
68 68
 			return $this->_bsComponent;
69 69
 	}
70 70
 
71
-	public function setStyled(){
71
+	public function setStyled() {
72 72
 		return $this->addToProperty("class", "styled");
73 73
 	}
74 74
 
75
-	public function activate($index){
75
+	public function activate($index) {
76 76
 		$this->getItem($index)->setActive(true);
77 77
 		return $this;
78 78
 	}
79 79
 
80
-	public function setExclusive($value){
80
+	public function setExclusive($value) {
81 81
 		$this->params["exclusive"]=$value;
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -30,23 +30,23 @@  discard block
 block discarded – undo
30 30
  * @property boolean $_edition
31 31
  * @property mixed _modelInstance
32 32
  */
33
-trait FieldAsTrait{
33
+trait FieldAsTrait {
34 34
 
35
-	abstract protected function _getFieldIdentifier($prefix,$name="");
36
-	abstract public function setValueFunction($index,$callback);
35
+	abstract protected function _getFieldIdentifier($prefix, $name="");
36
+	abstract public function setValueFunction($index, $callback);
37 37
 	abstract protected function _getFieldName($index);
38 38
 	abstract protected function _getFieldCaption($index);
39
-	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
39
+	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL);
40 40
 
41 41
 	/**
42 42
 	 * @param HtmlFormField $element
43 43
 	 * @param array $attributes
44 44
 	 */
45
-	protected function _applyAttributes(BaseHtml $element,&$attributes,$index,$instance=null){
46
-		if(isset($attributes["jsCallback"])){
45
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
46
+		if (isset($attributes["jsCallback"])) {
47 47
 			$callback=$attributes["jsCallback"];
48
-			if(\is_callable($callback)){
49
-				$callback($element,$instance,$index,InstanceViewer::$index);
48
+			if (\is_callable($callback)) {
49
+				$callback($element, $instance, $index, InstanceViewer::$index);
50 50
 			}
51 51
 		}
52 52
 		unset($attributes["rules"]);
@@ -55,43 +55,43 @@  discard block
 block discarded – undo
55 55
 		$element->fromArray($attributes);
56 56
 	}
57 57
 
58
-	private function _getLabelField($caption,$icon=NULL){
59
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
58
+	private function _getLabelField($caption, $icon=NULL) {
59
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
60 60
 		return $label;
61 61
 	}
62 62
 
63 63
 
64
-	protected function _addRules(HtmlFormField $element,&$attributes){
65
-		if(isset($attributes["rules"])){
64
+	protected function _addRules(HtmlFormField $element, &$attributes) {
65
+		if (isset($attributes["rules"])) {
66 66
 			$rules=$attributes["rules"];
67
-			if(\is_array($rules)){
67
+			if (\is_array($rules)) {
68 68
 				$element->addRules($rules);
69 69
 			}
70
-			else{
70
+			else {
71 71
 				$element->addRule($rules);
72 72
 			}
73 73
 			unset($attributes["rules"]);
74 74
 		}
75 75
 	}
76 76
 
77
-	protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){
77
+	protected function _prepareFormFields(HtmlFormField &$field, $name, &$attributes) {
78 78
 		$field->setName($name);
79 79
 		$this->_addRules($field, $attributes);
80 80
 		return $field;
81 81
 	}
82 82
 
83
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
84
-		$this->setValueFunction($index,function($value,$instance,$index,$rowIndex) use (&$attributes,$elementCallback,$prefix){
83
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
84
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix){
85 85
 			$caption=$this->_getFieldCaption($index);
86 86
 			$name=$this->_getFieldName($index);
87
-			$id=$this->_getFieldIdentifier($prefix,$name);
88
-			if(isset($attributes["name"])){
87
+			$id=$this->_getFieldIdentifier($prefix, $name);
88
+			if (isset($attributes["name"])) {
89 89
 				$name=$attributes["name"];
90 90
 				unset($attributes["name"]);
91 91
 			}
92
-			$element=$elementCallback($id,$name,$value,$caption);
93
-			if(\is_array($attributes)){
94
-				$this->_applyAttributes($element, $attributes,$index,$instance);
92
+			$element=$elementCallback($id, $name, $value, $caption);
93
+			if (\is_array($attributes)) {
94
+				$this->_applyAttributes($element, $attributes, $index, $instance);
95 95
 			}
96 96
 			$element->setDisabled(!$this->_edition);
97 97
 			return $element;
@@ -100,197 +100,197 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 
103
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
104
-		$this->setValueFunction($index,function($value) use($label,$attributes){
105
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
103
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
104
+		$this->setValueFunction($index, function($value) use($label, $attributes){
105
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
106 106
 			return $pb;
107 107
 		});
108 108
 			return $this;
109 109
 	}
110 110
 
111
-	public function fieldAsRating($index,$max=5, $icon=""){
112
-		$this->setValueFunction($index,function($value) use($max,$icon){
113
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
111
+	public function fieldAsRating($index, $max=5, $icon="") {
112
+		$this->setValueFunction($index, function($value) use($max, $icon){
113
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
114 114
 			return $rating;
115 115
 		});
116 116
 			return $this;
117 117
 	}
118 118
 
119
-	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
120
-		return $this->_fieldAs(function($id,$name,$value) use($icon){
121
-			$lbl=new HtmlLabel($id,$value);
122
-			if(isset($icon))
119
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
120
+		return $this->_fieldAs(function($id, $name, $value) use($icon){
121
+			$lbl=new HtmlLabel($id, $value);
122
+			if (isset($icon))
123 123
 				$lbl->addIcon($icon);
124 124
 				return $lbl;
125
-		}, $index,$attributes,"label");
125
+		}, $index, $attributes, "label");
126 126
 	}
127 127
 
128
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
129
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
130
-			$header=new HtmlHeader($id,$niveau,$value);
131
-			if(isset($icon))
128
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
129
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
130
+			$header=new HtmlHeader($id, $niveau, $value);
131
+			if (isset($icon))
132 132
 				$header->asIcon($icon, $value);
133 133
 			return $header;
134
-		}, $index,$attributes,"header");
134
+		}, $index, $attributes, "header");
135 135
 	}
136 136
 
137 137
 
138
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
139
-		$this->setValueFunction($index,function($img) use($size,$circular){
140
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
138
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
139
+		$this->setValueFunction($index, function($img) use($size, $circular){
140
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
141 141
 			return $image;
142 142
 		});
143 143
 			return $this;
144 144
 	}
145 145
 
146
-	public function fieldAsFlag($index){
147
-		$this->setValueFunction($index,function($flag){
148
-			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag);
146
+	public function fieldAsFlag($index) {
147
+		$this->setValueFunction($index, function($flag) {
148
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
149 149
 			return $flag;
150 150
 		});
151 151
 			return $this;
152 152
 	}
153 153
 
154
-	public function fieldAsIcon($index){
155
-		$this->setValueFunction($index,function($icon){
156
-			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"),$icon);
154
+	public function fieldAsIcon($index) {
155
+		$this->setValueFunction($index, function($icon) {
156
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
157 157
 			return $icon;
158 158
 		});
159 159
 			return $this;
160 160
 	}
161 161
 
162
-	public function fieldAsAvatar($index,$attributes=NULL){
163
-		return $this->_fieldAs(function($id,$name,$value){
164
-			$img=new HtmlImage($id,$value);
162
+	public function fieldAsAvatar($index, $attributes=NULL) {
163
+		return $this->_fieldAs(function($id, $name, $value) {
164
+			$img=new HtmlImage($id, $value);
165 165
 			$img->asAvatar();
166 166
 			return $img;
167
-		}, $index,$attributes,"avatar");
167
+		}, $index, $attributes, "avatar");
168 168
 	}
169 169
 
170
-	public function fieldAsRadio($index,$attributes=NULL){
171
-		return $this->_fieldAs(function($id,$name,$value) use($attributes){
172
-			$input= new HtmlFormRadio($id,$name,$value,$value);
170
+	public function fieldAsRadio($index, $attributes=NULL) {
171
+		return $this->_fieldAs(function($id, $name, $value) use($attributes){
172
+			$input=new HtmlFormRadio($id, $name, $value, $value);
173 173
 			return $this->_prepareFormFields($input, $name, $attributes);
174
-		}, $index,$attributes,"radio");
174
+		}, $index, $attributes, "radio");
175 175
 	}
176 176
 
177
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
178
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
179
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
180
-		}, $index,$attributes,"radios");
177
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
178
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
179
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
180
+		}, $index, $attributes, "radios");
181 181
 	}
182 182
 
183
-	public function fieldAsInput($index,$attributes=NULL){
184
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
185
-			$input= new HtmlFormInput($id,$caption,"text",$value);
183
+	public function fieldAsInput($index, $attributes=NULL) {
184
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
185
+			$input=new HtmlFormInput($id, $caption, "text", $value);
186 186
 			return $this->_prepareFormFields($input, $name, $attributes);
187
-		}, $index,$attributes,"input");
187
+		}, $index, $attributes, "input");
188 188
 	}
189 189
 
190
-	public function fieldAsTextarea($index,$attributes=NULL){
191
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
192
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
190
+	public function fieldAsTextarea($index, $attributes=NULL) {
191
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
192
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
193 193
 			return $this->_prepareFormFields($textarea, $name, $attributes);
194
-		}, $index,$attributes,"textarea");
194
+		}, $index, $attributes, "textarea");
195 195
 	}
196 196
 
197
-	public function fieldAsElement($index,$tagName="div",$baseClass="",$attributes=NULL){
198
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes,$tagName,$baseClass){
199
-			$div=new HtmlSemDoubleElement($id,$tagName,$baseClass);
197
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
198
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass){
199
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
200 200
 			$div->setContent(\htmlentities($value));
201
-			$textarea=new HtmlFormField("field-".$id, $div,$caption);
201
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
202 202
 			return $this->_prepareFormFields($textarea, $name, $attributes);
203
-		}, $index,$attributes,"element");
203
+		}, $index, $attributes, "element");
204 204
 	}
205 205
 
206 206
 
207
-	public function fieldAsHidden($index,$attributes=NULL){
208
-		if(!\is_array($attributes)){
207
+	public function fieldAsHidden($index, $attributes=NULL) {
208
+		if (!\is_array($attributes)) {
209 209
 			$attributes=[];
210 210
 		}
211 211
 		$attributes["inputType"]="hidden";
212 212
 		$attributes["style"]="display:none;";
213
-		return $this->fieldAsInput($index,$attributes);
213
+		return $this->fieldAsInput($index, $attributes);
214 214
 	}
215 215
 
216
-	public function fieldAsCheckbox($index,$attributes=NULL){
217
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
218
-			if($caption===null || $caption==="")
216
+	public function fieldAsCheckbox($index, $attributes=NULL) {
217
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){
218
+			if ($caption===null || $caption==="")
219 219
 				$caption="";
220
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
220
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
221 221
 			$input->setChecked(JString::isBooleanTrue($value));
222 222
 			return $this->_prepareFormFields($input, $name, $attributes);
223
-		}, $index,$attributes,"ck");
223
+		}, $index, $attributes, "ck");
224 224
 	}
225 225
 
226
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
227
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){
228
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
229
-			$dd->asSelect($name,$multiple);
226
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
227
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){
228
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
229
+			$dd->asSelect($name, $multiple);
230 230
 			return $this->_prepareFormFields($dd, $name, $attributes);
231
-		}, $index,$attributes,"dd");
231
+		}, $index, $attributes, "dd");
232 232
 	}
233 233
 
234
-	public function fieldAsMessage($index,$attributes=NULL){
235
-		return $this->_fieldAs(function($id,$name,$value,$caption){
236
-			$mess= new HtmlMessage("message-".$id,$caption);
234
+	public function fieldAsMessage($index, $attributes=NULL) {
235
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
236
+			$mess=new HtmlMessage("message-".$id, $caption);
237 237
 			$mess->addHeader($value);
238 238
 			return $mess;
239
-		}, $index,$attributes,"message");
239
+		}, $index, $attributes, "message");
240 240
 	}
241 241
 
242
-	public function fieldAsLink($index,$attributes=NULL){
243
-		return $this->_fieldAs(function($id,$name,$value,$caption){
244
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
242
+	public function fieldAsLink($index, $attributes=NULL) {
243
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
244
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
245 245
 			return $lnk;
246
-		}, $index,$attributes,"link");
246
+		}, $index, $attributes, "link");
247 247
 	}
248 248
 
249 249
 	/**Change fields type
250 250
 	 * @param array $types an array or associative array $type=>$attributes
251 251
 	 */
252
-	public function fieldsAs(array $types){
252
+	public function fieldsAs(array $types) {
253 253
 		$i=0;
254
-		if(JArray::isAssociative($types)){
255
-			foreach ($types as $type=>$attributes){
256
-				if(\is_int($type))
257
-					$this->fieldAs($i++,$attributes,[]);
258
-				else{
259
-					$type=preg_replace('/\d/', '', $type );
260
-					$this->fieldAs($i++,$type,$attributes);
254
+		if (JArray::isAssociative($types)) {
255
+			foreach ($types as $type=>$attributes) {
256
+				if (\is_int($type))
257
+					$this->fieldAs($i++, $attributes, []);
258
+				else {
259
+					$type=preg_replace('/\d/', '', $type);
260
+					$this->fieldAs($i++, $type, $attributes);
261 261
 				}
262 262
 			}
263
-		}else{
264
-			foreach ($types as $type){
265
-				$this->fieldAs($i++,$type);
263
+		} else {
264
+			foreach ($types as $type) {
265
+				$this->fieldAs($i++, $type);
266 266
 			}
267 267
 		}
268 268
 	}
269 269
 
270
-	public function fieldAs($index,$type,$attributes=NULL){
270
+	public function fieldAs($index, $type, $attributes=NULL) {
271 271
 		$method="fieldAs".\ucfirst($type);
272
-		if(\method_exists($this, $method)){
273
-			if(!\is_array($attributes)){
272
+		if (\method_exists($this, $method)) {
273
+			if (!\is_array($attributes)) {
274 274
 				$attributes=[$index];
275
-			}else{
275
+			} else {
276 276
 				\array_unshift($attributes, $index);
277 277
 			}
278
-			\call_user_func_array([$this,$method], $attributes);
278
+			\call_user_func_array([$this, $method], $attributes);
279 279
 		}
280 280
 	}
281 281
 
282
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
283
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
284
-			$button=new HtmlButton($id,$caption,$cssStyle);
285
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
282
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
283
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
284
+			$button=new HtmlButton($id, $caption, $cssStyle);
285
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
286 286
 			return $button;
287
-		}, $index,$attributes,"submit");
287
+		}, $index, $attributes, "submit");
288 288
 	}
289 289
 
290
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
291
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
292
-			$button=new HtmlButton($id,$value,$cssStyle);
290
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
291
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
292
+			$button=new HtmlButton($id, $value, $cssStyle);
293 293
 			return $button;
294
-		}, $index,$attributes,"button");
294
+		}, $index, $attributes, "button");
295 295
 	}
296 296
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -19,220 +19,220 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static $index=0;
21 21
 
22
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
22
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
26
+		if (isset($instance))
27 27
 			$this->setInstance($instance);
28 28
 		$this->setCaptions($captions);
29 29
 		$this->captionCallback=NULL;
30
-		$this->defaultValueFunction=function($name,$value){return $value;};
30
+		$this->defaultValueFunction=function($name, $value) {return $value; };
31 31
 	}
32 32
 
33
-	public function moveFieldTo($from,$to){
34
-		if(JArray::moveElementTo($this->visibleProperties, $from, $to)){
33
+	public function moveFieldTo($from, $to) {
34
+		if (JArray::moveElementTo($this->visibleProperties, $from, $to)) {
35 35
 			return JArray::moveElementTo($this->values, $from, $to);
36 36
 		}
37 37
 		return false;
38 38
 	}
39 39
 
40
-	public function swapFields($index1,$index2){
41
-		if(JArray::swapElements($this->visibleProperties, $index1, $index2)){
40
+	public function swapFields($index1, $index2) {
41
+		if (JArray::swapElements($this->visibleProperties, $index1, $index2)) {
42 42
 			return JArray::swapElements($this->values, $index1, $index2);
43 43
 		}
44 44
 		return false;
45 45
 	}
46 46
 
47
-	public function removeField($index){
48
-		\array_splice($this->visibleProperties,$index,1);
49
-		\array_splice($this->values,$index,1);
50
-		\array_splice($this->captions,$index,1);
47
+	public function removeField($index) {
48
+		\array_splice($this->visibleProperties, $index, 1);
49
+		\array_splice($this->values, $index, 1);
50
+		\array_splice($this->captions, $index, 1);
51 51
 		return $this;
52 52
 	}
53 53
 
54
-	public function getValues(){
54
+	public function getValues() {
55 55
 		$values=[];
56 56
 		$index=0;
57 57
 		$count=$this->count();
58
-		while($index<$count){
58
+		while ($index<$count) {
59 59
 			$values[]=$this->getValue($index++);
60 60
 		}
61 61
 		return $values;
62 62
 	}
63 63
 
64
-	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
64
+	public function getIdentifier($index=NULL) {
65
+		if (!isset($index))
66 66
 			$index=self::$index;
67 67
 		$value=$index;
68
-		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
68
+		if (isset($this->values["identifier"])) {
69
+			if (\is_string($this->values["identifier"]))
70 70
 				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71 71
 			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
72
+				$value=$this->values["identifier"]($index, $this->instance);
73 73
 		}
74 74
 		return $value;
75 75
 	}
76 76
 
77
-	public function getValue($index){
77
+	public function getValue($index) {
78 78
 		$property=$this->properties[$index];
79 79
 		return $this->_getValue($property, $index);
80 80
 	}
81 81
 
82
-	protected function _beforeAddProperty($index,&$field){
82
+	protected function _beforeAddProperty($index, &$field) {
83 83
 
84 84
 	}
85 85
 
86
-	protected function _getDefaultValue($name,$value,$index){
86
+	protected function _getDefaultValue($name, $value, $index) {
87 87
 		$func=$this->defaultValueFunction;
88
-		return $func($name,$value,$index,$this->instance);
88
+		return $func($name, $value, $index, $this->instance);
89 89
 	}
90 90
 
91
-	protected function _getPropertyValue(\ReflectionProperty $property,$index){
91
+	protected function _getPropertyValue(\ReflectionProperty $property, $index) {
92 92
 		$property->setAccessible(true);
93 93
 		return $property->getValue($this->instance);
94 94
 	}
95 95
 
96
-	protected function _getValue($property,$index){
96
+	protected function _getValue($property, $index) {
97 97
 		$value=null;
98 98
 		$propertyName=$property;
99
-		if($property instanceof \ReflectionProperty){
99
+		if ($property instanceof \ReflectionProperty) {
100 100
 			$value=$this->_getPropertyValue($property, $index);
101 101
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
102
+		}elseif (\is_callable($property))
103 103
 			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
-			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
104
+		elseif (\is_array($property)) {
105
+			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
106 106
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
107
+		}elseif (\is_string($property)) {
108 108
 			$value=$property;
109
-			if(isset($this->instance->{$property})){
109
+			if (isset($this->instance->{$property})) {
110 110
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
111
+			}elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) {
112 112
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 113
 			}
114 114
 		}
115 115
 		return $this->_postGetValue($index, $propertyName, $value);
116 116
 	}
117 117
 
118
-	protected function _postGetValue($index,$propertyName,$value){
119
-		if(isset($this->values[$index])){
120
-			$value= $this->values[$index]($value,$this->instance,$index,self::$index);
121
-		}else{
122
-			$value=$this->_getDefaultValue($propertyName,$value, $index,self::$index);
118
+	protected function _postGetValue($index, $propertyName, $value) {
119
+		if (isset($this->values[$index])) {
120
+			$value=$this->values[$index]($value, $this->instance, $index, self::$index);
121
+		} else {
122
+			$value=$this->_getDefaultValue($propertyName, $value, $index, self::$index);
123 123
 		}
124
-		if(isset($this->afterCompile[$index])){
125
-			if(\is_callable($this->afterCompile[$index])){
126
-				$this->afterCompile[$index]($value,$this->instance,self::$index);
124
+		if (isset($this->afterCompile[$index])) {
125
+			if (\is_callable($this->afterCompile[$index])) {
126
+				$this->afterCompile[$index]($value, $this->instance, self::$index);
127 127
 			}
128 128
 		}
129 129
 		return $value;
130 130
 	}
131 131
 
132
-	public function insertField($index,$field){
133
-		array_splice( $this->visibleProperties, $index, 0, $field );
132
+	public function insertField($index, $field) {
133
+		array_splice($this->visibleProperties, $index, 0, $field);
134 134
 		return $this;
135 135
 	}
136 136
 
137
-	public function insertInField($index,$field){
137
+	public function insertInField($index, $field) {
138 138
 		$vb=$this->visibleProperties;
139
-		if(isset($vb[$index])){
140
-			if(\is_array($vb[$index])){
139
+		if (isset($vb[$index])) {
140
+			if (\is_array($vb[$index])) {
141 141
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
143
-				$this->visibleProperties[$index]=[$vb[$index],$field];
142
+			} else {
143
+				$this->visibleProperties[$index]=[$vb[$index], $field];
144 144
 			}
145
-		}else{
145
+		} else {
146 146
 			return $this->insertField($index, $field);
147 147
 		}
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function addField($field){
151
+	public function addField($field) {
152 152
 		$this->visibleProperties[]=$field;
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function addFields($fields){
157
-		$this->visibleProperties=\array_merge($this->visibleProperties,$fields);
156
+	public function addFields($fields) {
157
+		$this->visibleProperties=\array_merge($this->visibleProperties, $fields);
158 158
 		return $this;
159 159
 	}
160 160
 
161
-	public function count(){
161
+	public function count() {
162 162
 		return \sizeof($this->properties);
163 163
 	}
164 164
 
165
-	public function visiblePropertiesCount(){
165
+	public function visiblePropertiesCount() {
166 166
 		return \sizeof($this->visibleProperties);
167 167
 	}
168 168
 
169
-	public function getProperty($index){
169
+	public function getProperty($index) {
170 170
 		return $this->properties[$index];
171 171
 	}
172 172
 
173
-	public function getFieldName($index){
173
+	public function getFieldName($index) {
174 174
 		$property=$this->getProperty($index);
175
-		if($property instanceof \ReflectionProperty){
175
+		if ($property instanceof \ReflectionProperty) {
176 176
 			$result=$property->getName();
177
-		}elseif(\is_callable($property)){
177
+		}elseif (\is_callable($property)) {
178 178
 			$result=$this->visibleProperties[$index];
179
-		}else{
179
+		} else {
180 180
 			$result=$property;
181 181
 		}
182 182
 		return $result;
183 183
 	}
184 184
 
185 185
 
186
-	protected function showableProperty(\ReflectionProperty $rProperty){
187
-		return JString::startswith($rProperty->getName(),"_")===false;
186
+	protected function showableProperty(\ReflectionProperty $rProperty) {
187
+		return JString::startswith($rProperty->getName(), "_")===false;
188 188
 	}
189 189
 
190 190
 	public function setInstance($instance) {
191
-		if(\is_string($instance)){
191
+		if (\is_string($instance)) {
192 192
 			$instance=new $instance();
193 193
 		}
194 194
 		$this->instance=$instance;
195 195
 		$this->properties=[];
196 196
 		$this->reflect=new \ReflectionClass($instance);
197
-		if(JArray::count($this->visibleProperties)===0){
197
+		if (JArray::count($this->visibleProperties)===0) {
198 198
 			$this->properties=$this->getDefaultProperties();
199
-		}else{
200
-			foreach ($this->visibleProperties as $property){
199
+		} else {
200
+			foreach ($this->visibleProperties as $property) {
201 201
 				$this->setInstanceProperty($property);
202 202
 			}
203 203
 		}
204 204
 		return $this;
205 205
 	}
206 206
 
207
-	private function setInstanceProperty($property){
208
-		if(\is_callable($property)){
207
+	private function setInstanceProperty($property) {
208
+		if (\is_callable($property)) {
209 209
 			$this->properties[]=$property;
210
-		}elseif(\is_string($property)){
211
-			try{
210
+		}elseif (\is_string($property)) {
211
+			try {
212 212
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
213 213
 				$rProperty=$this->reflect->getProperty($property);
214 214
 				$this->properties[]=$rProperty;
215
-			}catch(\Exception $e){
215
+			}catch (\Exception $e) {
216 216
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
217 217
 				$this->properties[]=$property;
218 218
 			}
219
-		}elseif(\is_int($property)){
219
+		}elseif (\is_int($property)) {
220 220
 			$props=$this->getDefaultProperties();
221
-			if(isset($props[$property]))
221
+			if (isset($props[$property]))
222 222
 				$this->properties[]=$props[$property];
223 223
 				else
224 224
 					$this->properties[]=$property;
225
-		}else{
225
+		} else {
226 226
 			$this->properties[]=$property;
227 227
 		}
228 228
 	}
229 229
 
230
-	protected function getDefaultProperties(){
230
+	protected function getDefaultProperties() {
231 231
 		$result=[];
232 232
 		$properties=$this->reflect->getProperties();
233
-		foreach ($properties as $property){
233
+		foreach ($properties as $property) {
234 234
 			$showable=$this->showableProperty($property);
235
-			if($showable!==false){
235
+			if ($showable!==false) {
236 236
 				$result[]=$property;
237 237
 			}
238 238
 		}
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 		return $this;
245 245
 	}
246 246
 
247
-	public function setValueFunction($index,$callback){
247
+	public function setValueFunction($index, $callback) {
248 248
 		$this->values[$index]=$callback;
249 249
 		return $this;
250 250
 	}
251 251
 
252
-	public function setIdentifierFunction($callback){
252
+	public function setIdentifierFunction($callback) {
253 253
 		$this->values["identifier"]=$callback;
254 254
 		return $this;
255 255
 	}
@@ -262,42 +262,42 @@  discard block
 block discarded – undo
262 262
 		return $this->properties;
263 263
 	}
264 264
 
265
-	public function getCaption($index){
266
-		if(isset($this->captions[$index])){
265
+	public function getCaption($index) {
266
+		if (isset($this->captions[$index])) {
267 267
 			return $this->captions[$index];
268 268
 		}
269
-		if($this->properties[$index] instanceof \ReflectionProperty)
269
+		if ($this->properties[$index] instanceof \ReflectionProperty)
270 270
 			return $this->properties[$index]->getName();
271
-		elseif(\is_callable($this->properties[$index]))
271
+		elseif (\is_callable($this->properties[$index]))
272 272
 			return "";
273 273
 		else
274 274
 			return $this->properties[$index];
275 275
 	}
276 276
 
277
-	public function getCaptions(){
277
+	public function getCaptions() {
278 278
 		$count=$this->count();
279
-		if(isset($this->captions)){
280
-			$captions= \array_values($this->captions);
279
+		if (isset($this->captions)) {
280
+			$captions=\array_values($this->captions);
281 281
 			$captionsSize=\sizeof($captions);
282
-			for($i=$captionsSize;$i<$count;$i++){
282
+			for ($i=$captionsSize; $i<$count; $i++) {
283 283
 				$captions[]="";
284 284
 			}
285
-		}else{
285
+		} else {
286 286
 			$captions=[];
287 287
 			$index=0;
288
-			while($index<$count){
288
+			while ($index<$count) {
289 289
 				$captions[]=$this->getCaption($index++);
290 290
 			}
291 291
 		}
292
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
292
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
293 293
 			$callback=$this->captionCallback;
294
-			$callback($captions,$this->instance);
294
+			$callback($captions, $this->instance);
295 295
 		}
296 296
 		return $captions;
297 297
 	}
298 298
 
299
-	public function setCaption($index,$caption){
300
-		if(isset($this->captions)===false)
299
+	public function setCaption($index, $caption) {
300
+		if (isset($this->captions)===false)
301 301
 			$this->captions=[];
302 302
 		$this->captions[$index]=$caption;
303 303
 		return $this;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @param callable $callback function called after the field compilation
316 316
 	 * @return InstanceViewer
317 317
 	 */
318
-	public function afterCompile($index,$callback){
318
+	public function afterCompile($index, $callback) {
319 319
 		$this->afterCompile[$index]=$callback;
320 320
 		return $this;
321 321
 	}
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlDropdown.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	public function addItem($caption, $href="#") {
91 91
 		if($caption instanceof HtmlDropdownItem){
92 92
 			$item=$caption;
93
-		}else{
93
+		} else{
94 94
 			$iid=$this->getItemsCount()+1;
95 95
 			$item=new HtmlDropdownItem($this->identifier."-dropdown-item-".$iid);
96 96
 			$item->setCaption($caption)->setHref($href);
@@ -130,10 +130,11 @@  discard block
 block discarded – undo
130 130
 	 * @see BaseHtml::fromArray()
131 131
 	 */
132 132
 	public function fromArray($array) {
133
-		if (array_keys($array)!==range(0, count($array)-1))
134
-			return parent::fromArray($array);
135
-		else
136
-			return $this->addItems($array);
133
+		if (array_keys($array)!==range(0, count($array)-1)) {
134
+					return parent::fromArray($array);
135
+		} else {
136
+					return $this->addItems($array);
137
+		}
137 138
 	}
138 139
 
139 140
 	public function setItems($items) {
@@ -186,8 +187,9 @@  discard block
 block discarded – undo
186 187
 	 * @see BaseHtml::setTagName()
187 188
 	 */
188 189
 	public function setTagName($tagName) {
189
-		if ($tagName=="button")
190
-			$this->class="btn dropdown-toggle";
190
+		if ($tagName=="button") {
191
+					$this->class="btn dropdown-toggle";
192
+		}
191 193
 		return parent::setTagName($tagName);
192 194
 	}
193 195
 
@@ -205,8 +207,9 @@  discard block
 block discarded – undo
205 207
 	}
206 208
 
207 209
 	public function setAlignment($alignment) {
208
-		if (is_int($alignment))
209
-			$alignment="dropdown-menu-".CssRef::alignment()[$alignment];
210
+		if (is_int($alignment)) {
211
+					$alignment="dropdown-menu-".CssRef::alignment()[$alignment];
212
+		}
210 213
 		return $this->addToMemberCtrl($this->class, $alignment, CssRef::alignment());
211 214
 	}
212 215
 
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlBreadcrumbs.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	 * @param boolean $autoActive sets the last element's class to <b>active</b> if true
42 42
 	 * @param callable $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()}
43 43
 	 */
44
-	public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){
45
-		parent::__construct($identifier,"ol");
44
+	public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) {
45
+		parent::__construct($identifier, "ol");
46 46
 		$this->startIndex=$startIndex;
47 47
 		$this->setProperty("class", "breadcrumb");
48 48
 		$this->content=array();
49 49
 		$this->autoActive=$autoActive;
50 50
 		$this->absolutePaths;
51
-		$this->_hrefFunction=function (HtmlDoubleElement $e){return $e->getContent();};
52
-		if(isset($hrefFunction)){
51
+		$this->_hrefFunction=function(HtmlDoubleElement $e) {return $e->getContent(); };
52
+		if (isset($hrefFunction)) {
53 53
 			$this->_hrefFunction=$hrefFunction;
54 54
 		}
55 55
 		$this->addElements($elements);
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 	 * @param string $href
61 61
 	 * @return \Ajax\bootstrap\html\HtmlLink
62 62
 	 */
63
-	public function addElement($element,$href="",$glyph=NULL){
63
+	public function addElement($element, $href="", $glyph=NULL) {
64 64
 		$size=sizeof($this->content);
65
-		if(\is_array($element)){
65
+		if (\is_array($element)) {
66 66
 			$elm=new HtmlLink("lnk-".$this->identifier."-".$size);
67 67
 			$elm->fromArray($element);
68
-		}else if($element instanceof HtmlLink){
68
+		} else if ($element instanceof HtmlLink) {
69 69
 			$elm=$element;
70
-		}else{
71
-			$elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element);
72
-			if(isset($glyph)){
70
+		} else {
71
+			$elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element);
72
+			if (isset($glyph)) {
73 73
 				$elm->wrapContentWithGlyph($glyph);
74 74
 			}
75 75
 		}
76
-		$elm->wrap("<li>","</li>");
76
+		$elm->wrap("<li>", "</li>");
77 77
 		$this->content[]=$elm;
78 78
 		$elm->setProperty($this->attr, $this->getHref($size));
79 79
 		return $elm;
80 80
 	}
81 81
 
82
-	public function setActive($index=null){
83
-		if(!isset($index)){
82
+	public function setActive($index=null) {
83
+		if (!isset($index)) {
84 84
 			$index=sizeof($this->content)-1;
85 85
 		}
86
-		$li=new HtmlBsDoubleElement("","li");
86
+		$li=new HtmlBsDoubleElement("", "li");
87 87
 		$li->setClass("active");
88 88
 		$li->setContent($this->content[$index]->getContent());
89 89
 		$this->content[$index]=$li;
90 90
 	}
91 91
 
92
-	public function addElements($elements){
93
-		foreach ( $elements as $element ) {
92
+	public function addElements($elements) {
93
+		foreach ($elements as $element) {
94 94
 			$this->addElement($element);
95 95
 		}
96 96
 		return $this;
97 97
 	}
98 98
 
99
-	public function fromArray($array){
99
+	public function fromArray($array) {
100 100
 		$array=parent::fromArray($array);
101 101
 		$this->addElements($array);
102 102
 		return $array;
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	 * @param string $separator
109 109
 	 * @return string
110 110
 	 */
111
-	public function getHref($index=null,$separator="/"){
112
-		if(!isset($index)){
111
+	public function getHref($index=null, $separator="/") {
112
+		if (!isset($index)) {
113 113
 			$index=sizeof($this->content);
114 114
 		}
115
-		if($this->absolutePaths===true){
115
+		if ($this->absolutePaths===true) {
116 116
 			return $this->_hrefFunction($this->content[$index]);
117
-		}else{
118
-			return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1));
117
+		} else {
118
+			return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1));
119 119
 		}
120 120
 	}
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @see \Ajax\bootstrap\html\BaseHtml::compile()
125 125
 	 */
126 126
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
127
-		if($this->autoActive){
127
+		if ($this->autoActive) {
128 128
 			$this->setActive();
129 129
 		}
130 130
 		return parent::compile($js, $view);
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
143 143
 	 */
144 144
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
145
-		foreach ($this->content as $element){
146
-			$element->on($event,$jsCode,$stopPropagation,$preventDefault);
145
+		foreach ($this->content as $element) {
146
+			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
147 147
 		}
148 148
 		return $this;
149 149
 	}
150 150
 
151 151
 	public function setAutoActive($autoActive) {
152
-		$this->autoActive = $autoActive;
152
+		$this->autoActive=$autoActive;
153 153
 		return $this;
154 154
 	}
155 155
 
156 156
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
157
-		foreach ($this->content as $element){
157
+		foreach ($this->content as $element) {
158 158
 			$element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
159 159
 		}
160 160
 		return $this;
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 	 * @param string $targetSelector the target of the get
167 167
 	 * @return HtmlBreadcrumbs
168 168
 	 */
169
-	public function autoGetOnClick($targetSelector){
170
-		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
169
+	public function autoGetOnClick($targetSelector) {
170
+		return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr));
171 171
 	}
172 172
 
173
-	public function contentAsString(){
174
-		if($this->autoActive){
173
+	public function contentAsString() {
174
+		if ($this->autoActive) {
175 175
 			$this->setActive();
176 176
 		}
177 177
 		return parent::contentAsString();
178 178
 	}
179 179
 
180
-	public function getElement($index){
180
+	public function getElement($index) {
181 181
 		return $this->content[$index];
182 182
 	}
183 183
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @param mixed $glyph
187 187
 	 * @param int $index
188 188
 	 */
189
-	public function addGlyph($glyph,$index=0){
189
+	public function addGlyph($glyph, $index=0) {
190 190
 		$elm=$this->getElement($index);
191 191
 		return $elm->wrapContentWithGlyph($glyph);
192 192
 	}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param object $dispatcher the request dispatcher
198 198
 	 * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
199 199
 	 */
200
-	public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){
200
+	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) {
201 201
 		$this->startIndex=$startIndex;
202 202
 		return $this->addElements($js->fromDispatcher($dispatcher));
203 203
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
210 210
 	 */
211 211
 	public function setHrefFunction($_hrefFunction) {
212
-		$this->_hrefFunction = $_hrefFunction;
212
+		$this->_hrefFunction=$_hrefFunction;
213 213
 		return $this;
214 214
 	}
215 215
 
Please login to merge, or discard this patch.