Passed
Push — master ( ab2190...c627f6 )
by Jean-Christophe
03:57
created
Ajax/semantic/html/collections/HtmlBreadcrumb.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @var integer the start index for href generation
22 22
 	 */
23
-	protected $startIndex = 0;
23
+	protected $startIndex=0;
24 24
 
25 25
 	/**
26 26
 	 *
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @var boolean if set to true, the path of the elements is absolute
34 34
 	 */
35
-	protected $absolutePaths = false;
35
+	protected $absolutePaths=false;
36 36
 
37 37
 	/**
38 38
 	 *
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
 	 * @param callable $hrefFunction
50 50
 	 *        	the function who generates the href elements. default : function($e){return $e->getContent()}
51 51
 	 */
52
-	public function __construct($identifier, $items = array(), $autoActive = true, $startIndex = 0, $hrefFunction = NULL) {
52
+	public function __construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) {
53 53
 		parent::__construct($identifier, "div", "ui breadcrumb");
54
-		$this->startIndex = $startIndex;
55
-		$this->autoActive = $autoActive;
56
-		$this->_contentSeparator = "<div class='divider'> / </div>";
57
-		$this->_hrefFunction = function (HtmlSemDoubleElement $e) {
54
+		$this->startIndex=$startIndex;
55
+		$this->autoActive=$autoActive;
56
+		$this->_contentSeparator="<div class='divider'> / </div>";
57
+		$this->_hrefFunction=function(HtmlSemDoubleElement $e) {
58 58
 			return $e->getContent();
59 59
 		};
60 60
 		if (isset($hrefFunction)) {
61
-			$this->_hrefFunction = $hrefFunction;
61
+			$this->_hrefFunction=$hrefFunction;
62 62
 		}
63 63
 		$this->addItems($items);
64 64
 	}
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param int $index
90 90
 	 */
91
-	public function setActive($index = null) {
92
-		if (! isset($index)) {
93
-			$index = sizeof($this->content) - 1;
91
+	public function setActive($index=null) {
92
+		if (!isset($index)) {
93
+			$index=sizeof($this->content)-1;
94 94
 		}
95
-		$activeItem = $this->content[$index];
95
+		$activeItem=$this->content[$index];
96 96
 		$activeItem->addToProperty("class", "active");
97 97
 		$activeItem->setTagName("div");
98 98
 	}
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 *        	the request dispatcher
106 106
 	 * @return HtmlBreadcrumb
107 107
 	 */
108
-	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0) {
109
-		$this->startIndex = $startIndex;
108
+	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) {
109
+		$this->startIndex=$startIndex;
110 110
 		return $this->addItems($js->fromDispatcher($dispatcher));
111 111
 	}
112 112
 
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 * @param string $separator
118 118
 	 * @return string
119 119
 	 */
120
-	public function getHref($index = null, $separator = "/") {
121
-		if (! isset($index)) {
122
-			$index = sizeof($this->content);
120
+	public function getHref($index=null, $separator="/") {
121
+		if (!isset($index)) {
122
+			$index=sizeof($this->content);
123 123
 		}
124
-		if ($this->absolutePaths === true) {
124
+		if ($this->absolutePaths===true) {
125 125
 			return $this->_hrefFunction($this->content[$index]);
126 126
 		} else {
127
-			return $this->root . implode($separator, array_slice(array_map(function ($e) {
127
+			return $this->root.implode($separator, array_slice(array_map(function($e) {
128 128
 				return $this->_hrefFunction($e);
129
-			}, $this->content), $this->startIndex, $index + 1));
129
+			}, $this->content), $this->startIndex, $index+1));
130 130
 		}
131 131
 	}
132 132
 
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 	 * @return HtmlBreadcrumb
139 139
 	 */
140 140
 	public function setHrefFunction($_hrefFunction) {
141
-		$this->_hrefFunction = $_hrefFunction;
141
+		$this->_hrefFunction=$_hrefFunction;
142 142
 		return $this;
143 143
 	}
144 144
 
145 145
 	public function setStartIndex($startIndex) {
146
-		$this->startIndex = $startIndex;
146
+		$this->startIndex=$startIndex;
147 147
 		return $this;
148 148
 	}
149 149
 
150 150
 	public function setAutoActive($autoActive) {
151
-		$this->autoActive = $autoActive;
151
+		$this->autoActive=$autoActive;
152 152
 		return $this;
153 153
 	}
154 154
 
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 	 * (non-PHPdoc)
157 157
 	 * @see \Ajax\bootstrap\html\BaseHtml::compile()
158 158
 	 */
159
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
159
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
160 160
 		if ($this->autoActive) {
161 161
 			$this->setActive();
162 162
 		}
163
-		$count = $this->count();
164
-		for ($i = 1; $i < $count; $i ++) {
165
-			$this->content[$i]->wrap($this->getContentDivider($i - 1));
163
+		$count=$this->count();
164
+		for ($i=1; $i<$count; $i++) {
165
+			$this->content[$i]->wrap($this->getContentDivider($i-1));
166 166
 		}
167 167
 		return parent::compile($js, $view);
168 168
 	}
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 	 * (non-PHPdoc)
172 172
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
173 173
 	 */
174
-	public function on($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
174
+	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
175 175
 		foreach ($this->content as $element) {
176 176
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
177 177
 		}
178 178
 		return $this;
179 179
 	}
180 180
 
181
-	public function _ajaxOn($operation, $event, $url, $responseElement = "", $parameters = array()) {
181
+	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
182 182
 		foreach ($this->content as $element) {
183
-			if ($element->getProperty($this->attr) != NULL) {
183
+			if ($element->getProperty($this->attr)!=NULL) {
184 184
 				$element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
185 185
 			}
186 186
 		}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
195 195
 	 */
196 196
 	protected function createItem($value) {
197
-		$count = $this->count();
198
-		$itemO = new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section");
197
+		$count=$this->count();
198
+		$itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section");
199 199
 		if (\is_array($value)) {
200
-			@list ($text, $href) = $value;
200
+			@list ($text, $href)=$value;
201 201
 			$itemO->setContent($text);
202 202
 			$itemO->setProperty('href', $href);
203 203
 		} else {
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 	}
208 208
 
209 209
 	public function addIconAt($icon, $index) {
210
-		$item = $this->getItem($index);
210
+		$item=$this->getItem($index);
211 211
 		if (isset($item)) {
212
-			$icon = new HtmlIcon("icon-" . $this->identifier, $icon);
212
+			$icon=new HtmlIcon("icon-".$this->identifier, $icon);
213 213
 			$item->wrapContent($icon);
214 214
 		}
215 215
 	}
216 216
 
217 217
 	public function addItem($item) {
218
-		$count = $this->count();
219
-		$itemO = parent::addItem($item);
218
+		$count=$this->count();
219
+		$itemO=parent::addItem($item);
220 220
 		$this->addToPropertyCtrl("class", "section", array(
221 221
 			"section"
222 222
 		));
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	}
230 230
 
231 231
 	public function setAbsolutePaths($absolutePaths) {
232
-		$this->absolutePaths = $absolutePaths;
233
-		$size = \sizeof($this->content);
234
-		for ($i = 0; $i < $size; $i ++) {
232
+		$this->absolutePaths=$absolutePaths;
233
+		$size=\sizeof($this->content);
234
+		for ($i=0; $i<$size; $i++) {
235 235
 			$this->content[$i]->setProperty($this->attr, $this->getHref($i));
236 236
 		}
237 237
 		return $this;
Please login to merge, or discard this patch.