@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | - * @param $name |
|
162 | + * @param string $name |
|
163 | 163 | * |
164 | 164 | * @return mixed |
165 | 165 | */ |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
391 | - * @param $attr |
|
391 | + * @param string $attr |
|
392 | 392 | * |
393 | 393 | * @return string |
394 | 394 | */ |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setProps($props) |
128 | 128 | { |
129 | - if ( ! is_array($props) && ! ($props instanceof \Traversable)) { |
|
129 | + if (!is_array($props) && !($props instanceof \Traversable)) { |
|
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | foreach ($props as $name => $value) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function addClass($class) |
219 | 219 | { |
220 | - if ( ! $this->hasClass($class)) { |
|
220 | + if (!$this->hasClass($class)) { |
|
221 | 221 | $this->set('class', trim((string) $this->get('class') . ' ' . $class)); |
222 | 222 | } |
223 | 223 | |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function setContent($content) |
283 | 283 | { |
284 | - if ( ! $content) { |
|
284 | + if (!$content) { |
|
285 | 285 | return $this; |
286 | 286 | } |
287 | - if ( ! is_array($content)) { |
|
288 | - $content = array( $content ); |
|
287 | + if (!is_array($content)) { |
|
288 | + $content = array($content); |
|
289 | 289 | } |
290 | 290 | $this->clearContent(); |
291 | 291 | foreach ($content as $child) { |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | protected function addChild($tagTextOrArray) |
326 | 326 | { |
327 | 327 | // a list of arguments to be passed to builder->make() |
328 | - if (is_array($tagTextOrArray) && ! empty($tagTextOrArray)) { |
|
328 | + if (is_array($tagTextOrArray) && !empty($tagTextOrArray)) { |
|
329 | 329 | |
330 | - if ( ! isset($this->builder)) { |
|
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, $this->builder); |
338 | 338 | } |
339 | 339 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | ksort($attrs); |
356 | 356 | foreach ($attrs as $k => $v) { |
357 | 357 | if ($v !== true) { |
358 | - $result[] = $k . '="' . $this->escapeAttr((string)$v) . '"'; |
|
358 | + $result[] = $k . '="' . $this->escapeAttr((string) $v) . '"'; |
|
359 | 359 | } else { |
360 | 360 | $result[] = $k; |
361 | 361 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | protected function getValidAttributes() |
378 | 378 | { |
379 | - $attrs = [ ]; |
|
379 | + $attrs = []; |
|
380 | 380 | foreach ($this->getProps() as $k => $v) { |
381 | 381 | if (substr($k, 0, 1) !== '_') { |
382 | 382 | $attrs[$k] = $v; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | // Don't bother if there are no specialchars - saves some processing |
404 | - if ( ! preg_match('/[&<>"\']/', $attr)) { |
|
404 | + if (!preg_match('/[&<>"\']/', $attr)) { |
|
405 | 405 | return $attr; |
406 | 406 | } |
407 | 407 |
@@ -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 |