@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $name = $this->get('name'); |
34 | 34 | if (substr($name, - 2) !== '[]') { |
35 | - $this->set('name', $name . '[]'); |
|
35 | + $this->set('name', $name.'[]'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return parent::render(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function make($tag, $props = null, $content = null) |
108 | 108 | { |
109 | - if (! isset($this->tagFactories[$tag])) { |
|
109 | + if (!isset($this->tagFactories[$tag])) { |
|
110 | 110 | return Tag::create($tag, $props, $content, $this); |
111 | 111 | } |
112 | 112 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $tag = new $constructor($props, $content, $this); |
121 | 121 | } |
122 | 122 | |
123 | - if (! $tag || ! $tag instanceof Tag) { |
|
123 | + if (!$tag || !$tag instanceof Tag) { |
|
124 | 124 | throw new \InvalidArgumentException(sprintf( |
125 | 125 | 'The constructor for the `%s` tag did not generate a Tag object', |
126 | 126 | $tag |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | { |
151 | 151 | $method = preg_replace('/([A-Z]+)/', '-\1', $method); |
152 | 152 | $method = strtolower($method); |
153 | - if (! isset($args[0])) { |
|
153 | + if (!isset($args[0])) { |
|
154 | 154 | $args[0] = array(); |
155 | 155 | } |
156 | - if (! isset($args[1])) { |
|
156 | + if (!isset($args[1])) { |
|
157 | 157 | $args[1] = null; |
158 | 158 | } |
159 | - if (! isset($args[2])) { |
|
159 | + if (!isset($args[2])) { |
|
160 | 160 | $args[2] = null; |
161 | 161 | } |
162 | 162 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function setProps($props) |
129 | 129 | { |
130 | - if (! is_array($props) && ! ($props instanceof \Traversable)) { |
|
130 | + if (!is_array($props) && !($props instanceof \Traversable)) { |
|
131 | 131 | return $this; |
132 | 132 | } |
133 | 133 | foreach ($props as $name => $value) { |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function addClass($class) |
220 | 220 | { |
221 | - if (! $this->hasClass($class)) { |
|
222 | - $this->set('class', trim((string) $this->get('class') . ' ' . $class)); |
|
221 | + if (!$this->hasClass($class)) { |
|
222 | + $this->set('class', trim((string) $this->get('class').' '.$class)); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | return $this; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | $classes = $this->get('class'); |
238 | 238 | if ($classes) { |
239 | - $classes = trim(preg_replace('/(^| ){1}' . $class . '( |$){1}/i', ' ', $classes)); |
|
239 | + $classes = trim(preg_replace('/(^| ){1}'.$class.'( |$){1}/i', ' ', $classes)); |
|
240 | 240 | $this->set('class', $classes); |
241 | 241 | } |
242 | 242 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | { |
271 | 271 | $classes = $this->get('class'); |
272 | 272 | |
273 | - return $classes && ((bool) preg_match('/(^| ){1}' . $class . '( |$){1}/i', $classes)); |
|
273 | + return $classes && ((bool) preg_match('/(^| ){1}'.$class.'( |$){1}/i', $classes)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function setContent($content) |
284 | 284 | { |
285 | - if (! $content) { |
|
285 | + if (!$content) { |
|
286 | 286 | return $this; |
287 | 287 | } |
288 | - if (! is_array($content)) { |
|
289 | - $content = array( $content ); |
|
288 | + if (!is_array($content)) { |
|
289 | + $content = array($content); |
|
290 | 290 | } |
291 | 291 | $this->clearContent(); |
292 | 292 | foreach ($content as $child) { |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | protected function addChild($tagTextOrArray) |
327 | 327 | { |
328 | 328 | // a list of arguments to be passed to builder->make() |
329 | - if (is_array($tagTextOrArray) && ! empty($tagTextOrArray)) { |
|
330 | - if (! isset($this->builder)) { |
|
329 | + if (is_array($tagTextOrArray) && !empty($tagTextOrArray)) { |
|
330 | + if (!isset($this->builder)) { |
|
331 | 331 | throw new \InvalidArgumentException(sprintf('Builder not attached to tag `%s`', $this->tag)); |
332 | 332 | } |
333 | 333 | |
334 | 334 | $tagName = $tagTextOrArray[0]; |
335 | - $props = isset($tagTextOrArray[1]) ? $tagTextOrArray[1] : [ ]; |
|
336 | - $content = isset($tagTextOrArray[2]) ? $tagTextOrArray[2] : [ ]; |
|
335 | + $props = isset($tagTextOrArray[1]) ? $tagTextOrArray[1] : []; |
|
336 | + $content = isset($tagTextOrArray[2]) ? $tagTextOrArray[2] : []; |
|
337 | 337 | $tagTextOrArray = $this->builder->make($tagName, $props, $content); |
338 | 338 | } |
339 | 339 | |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | foreach ($this->props as $k => $v) { |
356 | 356 | if (substr($k, 0, 1) !== '_') { |
357 | 357 | if ($v === true) { |
358 | - $result .= $k . ' '; |
|
358 | + $result .= $k.' '; |
|
359 | 359 | } else { |
360 | - $result .= $k . '="' . $this->escapeAttr($v) . '" '; |
|
360 | + $result .= $k.'="'.$this->escapeAttr($v).'" '; |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | } |
364 | 364 | if ($result) { |
365 | - $result = ' ' . trim($result); |
|
365 | + $result = ' '.trim($result); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | return $result; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | // Don't bother if there are no specialchars - saves some processing |
385 | - if (! preg_match('/[&<>"\']/', $attr)) { |
|
385 | + if (!preg_match('/[&<>"\']/', $attr)) { |
|
386 | 386 | return $attr; |
387 | 387 | } |
388 | 388 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $before = !empty($this->before) ? implode(PHP_EOL, $this->before) : ''; |
405 | 405 | $after = !empty($this->after) ? implode(PHP_EOL, $this->after) : ''; |
406 | 406 | |
407 | - return $before . $element . $after; |
|
407 | + return $before.$element.$after; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |