@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | public function testSimple1() |
18 | 18 | { |
19 | - $data = HtmlElement::init('<hr align="left">', ['width' => '80',]); |
|
19 | + $data = HtmlElement::init('<hr align="left">', ['width' => '80', ]); |
|
20 | 20 | $this->assertNotEmpty($data->getAttributes()); |
21 | 21 | $this->assertEquals('left', $data->getAttribute('align')); |
22 | 22 | $this->assertEquals('80', $data->getAttribute('width')); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function testSimple2() |
26 | 26 | { |
27 | - $data = HtmlElement::init('span', ['height' => '80',]); |
|
27 | + $data = HtmlElement::init('span', ['height' => '80', ]); |
|
28 | 28 | $this->assertNotEmpty($data->getAttributes()); |
29 | 29 | $this->assertEmpty($data->getAttribute('width')); |
30 | 30 | $this->assertEquals('80', $data->getAttribute('height')); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use TCss, TStyles; |
20 | 20 | |
21 | 21 | /** @var string[] */ |
22 | - protected static $emptyElements = ['img','hr','br','input','meta','area','embed','keygen','link','param','frame']; |
|
22 | + protected static $emptyElements = ['img', 'hr', 'br', 'input', 'meta', 'area', 'embed', 'keygen', 'link', 'param', 'frame']; |
|
23 | 23 | |
24 | 24 | /** @var string element's name */ |
25 | 25 | private $name = ''; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct(string $name, array $attributes = []) |
43 | 43 | { |
44 | - $name = str_ireplace(['<','>'],'', $name); |
|
44 | + $name = str_ireplace(['<', '>'], '', $name); |
|
45 | 45 | $parts = explode(' ', $name, 2); |
46 | 46 | $name = $parts[0]; |
47 | 47 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function getKey(): string |
39 | 39 | { |
40 | - return $this->key ; |
|
40 | + return $this->key; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function getDefault(): string |
@@ -47,6 +47,6 @@ discard block |
||
47 | 47 | |
48 | 48 | public function getValue(): string |
49 | 49 | { |
50 | - return $this->value ?? $this->default ; |
|
50 | + return $this->value ?? $this->default; |
|
51 | 51 | } |
52 | 52 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $alias = $child->getAlias(); |
81 | 81 | } |
82 | 82 | } else { |
83 | - $alias = $this->checkAlias($alias) ? strval($alias) : null ; |
|
83 | + $alias = $this->checkAlias($alias) ? strval($alias) : null; |
|
84 | 84 | $child = new Text(strval($child), $alias); |
85 | 85 | } |
86 | 86 | if (method_exists($child, 'setParent') && $this instanceof IHtmlElement) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if ($merge && $this->__isset(strval($alias))) { |
92 | 92 | $this->children[strval($alias)]->merge($child); |
93 | 93 | } |
94 | - $this->children[strval($alias)] = $inherit ? $this->inherit($child) : $child ; |
|
94 | + $this->children[strval($alias)] = $inherit ? $this->inherit($child) : $child; |
|
95 | 95 | } else { |
96 | 96 | $this->children[] = $child; |
97 | 97 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function checkAlias($alias): bool |
106 | 106 | { |
107 | - return !(is_null($alias) || ('' === $alias) || (is_object($alias)) || is_resource($alias) ); |
|
107 | + return !(is_null($alias) || ('' === $alias) || (is_object($alias)) || is_resource($alias)); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public function lastChild(): ?IHtmlElement |
149 | 149 | { |
150 | 150 | $last = end($this->children); |
151 | - return $last === false ? null : $last ; |
|
151 | + return $last === false ? null : $last; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function __get($alias): ?IHtmlElement |
187 | 187 | { |
188 | - return $this->__isset($alias) ? $this->children[$alias] : null ; |
|
188 | + return $this->__isset($alias) ? $this->children[$alias] : null; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -127,7 +127,7 @@ |
||
127 | 127 | */ |
128 | 128 | public function getAttribute(string $name): ?string |
129 | 129 | { |
130 | - return isset($this->attributes[$name]) ? $this->attributes[$name] : null ; |
|
130 | + return isset($this->attributes[$name]) ? $this->attributes[$name] : null; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | protected function getItem(string $key): ?Template\Item |
67 | 67 | { |
68 | - return isset($this->items[$key]) ? $this->items[$key] : null ; |
|
68 | + return isset($this->items[$key]) ? $this->items[$key] : null; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | protected function updateItem(string $key, ?string $value): self |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $map = []; |
99 | 99 | foreach ($this->items as $item) { |
100 | - $map[(string)$item->getKey()] = (string)$item->getValue(); |
|
100 | + $map[(string) $item->getKey()] = (string) $item->getValue(); |
|
101 | 101 | } |
102 | 102 | $this->template = strtr($this->template, $map); |
103 | 103 | } |