@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Beautifier; |
5 | 5 | |
6 | 6 | interface Beautifier |
7 | 7 | { |
8 | - public function beautify (int $level = 0) : Beautifier; |
|
8 | + public function beautify(int $level = 0) : Beautifier; |
|
9 | 9 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Get the html-representation of this document. |
40 | 40 | */ |
41 | - public function toHtml () : string |
|
41 | + public function toHtml() : string |
|
42 | 42 | { |
43 | 43 | return "<!DOCTYPE html>" . ($this->beautified ? "\n" : "") . $this->root->toHtml(); |
44 | 44 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param int $level The current level of indentation. This should always be 0. |
59 | 59 | */ |
60 | - public function beautify (int $level = 0) : Beautifier |
|
60 | + public function beautify(int $level = 0) : Beautifier |
|
61 | 61 | { |
62 | 62 | return new Document($this->root->beautify(), true); |
63 | 63 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | { |
51 | 51 | $indentChild = new Text("\n" . str_repeat(" ", $level + 1)); |
52 | 52 | $indentClosingTag = new Text("\n" . str_repeat(" ", $level)); |
53 | - $children = array_merge(array_reduce($this->childNodes, function ($children, $child) use ($level, $indentChild) { |
|
54 | - return array_merge($children, [$indentChild, $child->beautify($level + 1)]); |
|
55 | - }, []), [$indentClosingTag]); |
|
53 | + $children = array_merge(array_reduce($this->childNodes, function($children, $child) use ($level, $indentChild) { |
|
54 | + return array_merge($children, [ $indentChild, $child->beautify($level + 1) ]); |
|
55 | + }, [ ]), [ $indentClosingTag ]); |
|
56 | 56 | return new NormalElement($this->localName, $this->attributes, $children); |
57 | 57 | } |
58 | 58 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function childNodesToHtml() |
74 | 74 | { |
75 | - return array_reduce($this->childNodes, function ($html, $childNode) { |
|
75 | + return array_reduce($this->childNodes, function($html, $childNode) { |
|
76 | 76 | return $html . $childNode->toHtml(); |
77 | 77 | }, ''); |
78 | 78 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function attributesToHtml() |
24 | 24 | { |
25 | - return array_reduce($this->attributes, function ($html, $attribute) { |
|
25 | + return array_reduce($this->attributes, function($html, $attribute) { |
|
26 | 26 | $htmlAttribute = $attribute->toHtml(); |
27 | 27 | return "$html $htmlAttribute"; |
28 | 28 | }, ''); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Get the html-representation of this Comment |
30 | 30 | */ |
31 | - public function toHtml () : string |
|
31 | + public function toHtml() : string |
|
32 | 32 | { |
33 | 33 | $test = '/-->/ium'; // test for forbidden closing comment-tag |
34 | 34 | $replacement = '--\\>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param int $level The current level of indentation |
52 | 52 | */ |
53 | - public function beautify (int $level = 0) : Beautifier |
|
53 | + public function beautify(int $level = 0) : Beautifier |
|
54 | 54 | { |
55 | 55 | $indent = "\n" . str_repeat(" ", $level); |
56 | 56 | $beautified = $indent . str_replace("\n", $indent, $this->comment) . $indent; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Ast; |
5 | 5 | |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * @param string $localName A localName, that is escaped inside the |
42 | 42 | * text-content of this Text. |
43 | 43 | */ |
44 | - public function toRawText (string $localName) : string |
|
44 | + public function toRawText(string $localName) : string |
|
45 | 45 | { |
46 | 46 | $tests = [ |
47 | 47 | '/<(' . $localName . ')/ium', // test for forbidden opening tags |
48 | - '/<\/(' .$localName. ')/ium', // test for forbidden closing tags |
|
48 | + '/<\/(' . $localName . ')/ium', // test for forbidden closing tags |
|
49 | 49 | '/<!--/ium' // test for forbidden opening comments |
50 | 50 | ]; |
51 | 51 | $replacements = [ |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\Serializer; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Teein\Html\VirtualDom; |
5 | 5 |