@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function make($tag, $props = null, $content = null) |
| 111 | 111 | { |
| 112 | - if ( ! isset($this->tagFactories[$tag])) { |
|
| 112 | + if (!isset($this->tagFactories[$tag])) { |
|
| 113 | 113 | return Tag::create($tag, $props, $content, $this); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $tag = new $constructor($props, $content, $this); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( ! $tag || ! $tag instanceof Tag) { |
|
| 126 | + if (!$tag || !$tag instanceof Tag) { |
|
| 127 | 127 | throw new \InvalidArgumentException(sprintf('The constructor for the `%s` tag did not generate a Tag object', |
| 128 | 128 | $tag)); |
| 129 | 129 | } |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $method = preg_replace('/([A-Z]+)/', '-\1', $method); |
| 151 | 151 | $method = strtolower($method); |
| 152 | - if ( ! isset($args[0])) { |
|
| 152 | + if (!isset($args[0])) { |
|
| 153 | 153 | $args[0] = array(); |
| 154 | 154 | } |
| 155 | - if ( ! isset($args[1])) { |
|
| 155 | + if (!isset($args[1])) { |
|
| 156 | 156 | $args[1] = null; |
| 157 | 157 | } |
| 158 | - if ( ! isset($args[2])) { |
|
| 158 | + if (!isset($args[2])) { |
|
| 159 | 159 | $args[2] = null; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -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(); |
@@ -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,15 +326,15 @@ 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)) { |
|
| 329 | + if (is_array($tagTextOrArray) && !empty($tagTextOrArray)) { |
|
| 330 | 330 | |
| 331 | - if ( ! isset($this->builder)) { |
|
| 331 | + if (!isset($this->builder)) { |
|
| 332 | 332 | throw new \InvalidArgumentException(sprintf('Builder not attached to tag `%s`', $this->tag)); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | $tagName = $tagTextOrArray[0]; |
| 336 | - $props = isset($tagTextOrArray[1]) ? $tagTextOrArray[1] : [ ]; |
|
| 337 | - $content = isset($tagTextOrArray[2]) ? $tagTextOrArray[2] : [ ]; |
|
| 336 | + $props = isset($tagTextOrArray[1]) ? $tagTextOrArray[1] : []; |
|
| 337 | + $content = isset($tagTextOrArray[2]) ? $tagTextOrArray[2] : []; |
|
| 338 | 338 | $tagTextOrArray = $this->builder->make($tagName, $props, $content); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -356,14 +356,14 @@ discard block |
||
| 356 | 356 | foreach ($this->props as $k => $v) { |
| 357 | 357 | if (substr($k, 0, 1) !== '_') { |
| 358 | 358 | if ($v === true) { |
| 359 | - $result .= $k . ' '; |
|
| 359 | + $result .= $k.' '; |
|
| 360 | 360 | } else { |
| 361 | - $result .= $k . '="' . $this->escapeAttr($v) . '" '; |
|
| 361 | + $result .= $k.'="'.$this->escapeAttr($v).'" '; |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | if ($result) { |
| 366 | - $result = ' ' . trim($result); |
|
| 366 | + $result = ' '.trim($result); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | return $result; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // Don't bother if there are no specialchars - saves some processing |
| 386 | - if ( ! preg_match('/[&<>"\']/', $attr)) { |
|
| 386 | + if (!preg_match('/[&<>"\']/', $attr)) { |
|
| 387 | 387 | return $attr; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $before = !empty($this->before) ? implode(PHP_EOL, $this->before) : ''; |
| 406 | 406 | $after = !empty($this->after) ? implode(PHP_EOL, $this->after) : ''; |
| 407 | 407 | |
| 408 | - return $before . $element . $after; |
|
| 408 | + return $before.$element.$after; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |