@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function addElement(DeclarationInterface $element): NamespaceDeclaration |
59 | 59 | { |
60 | 60 | $this->elements->add($element); |
61 | - if ($element instanceof DependedInterface) { |
|
61 | + if ($element instanceof DependedInterface){ |
|
62 | 62 | $this->addUses($element->getDependencies()); |
63 | 63 | } |
64 | 64 | |
@@ -85,23 +85,23 @@ discard block |
||
85 | 85 | $result = ''; |
86 | 86 | $indentShift = 0; |
87 | 87 | |
88 | - if (!$this->docComment->isEmpty()) { |
|
89 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
88 | + if (!$this->docComment->isEmpty()){ |
|
89 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
90 | 90 | } |
91 | 91 | |
92 | - if (!empty($this->getName())) { |
|
93 | - $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n"; |
|
92 | + if (!empty($this->getName())){ |
|
93 | + $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel)."\n"; |
|
94 | 94 | $indentShift = 1; |
95 | 95 | } |
96 | 96 | |
97 | - if (!empty($this->uses)) { |
|
98 | - $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n"; |
|
97 | + if (!empty($this->uses)){ |
|
98 | + $result .= $this->renderUses($indentLevel + $indentShift)."\n\n"; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $result .= $this->elements->render($indentLevel + $indentShift); |
102 | 102 | |
103 | - if (!empty($this->getName())) { |
|
104 | - $result .= "\n" . $this->addIndent('}', $indentLevel); |
|
103 | + if (!empty($this->getName())){ |
|
104 | + $result .= "\n".$this->addIndent('}', $indentLevel); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $result; |
@@ -58,7 +58,8 @@ discard block |
||
58 | 58 | public function addElement(DeclarationInterface $element): NamespaceDeclaration |
59 | 59 | { |
60 | 60 | $this->elements->add($element); |
61 | - if ($element instanceof DependedInterface) { |
|
61 | + if ($element instanceof DependedInterface) |
|
62 | + { |
|
62 | 63 | $this->addUses($element->getDependencies()); |
63 | 64 | } |
64 | 65 | |
@@ -85,22 +86,26 @@ discard block |
||
85 | 86 | $result = ''; |
86 | 87 | $indentShift = 0; |
87 | 88 | |
88 | - if (!$this->docComment->isEmpty()) { |
|
89 | + if (!$this->docComment->isEmpty()) |
|
90 | + { |
|
89 | 91 | $result .= $this->docComment->render($indentLevel) . "\n"; |
90 | 92 | } |
91 | 93 | |
92 | - if (!empty($this->getName())) { |
|
94 | + if (!empty($this->getName())) |
|
95 | + { |
|
93 | 96 | $result .= $this->addIndent("namespace {$this->getName()} {", $indentLevel) . "\n"; |
94 | 97 | $indentShift = 1; |
95 | 98 | } |
96 | 99 | |
97 | - if (!empty($this->uses)) { |
|
100 | + if (!empty($this->uses)) |
|
101 | + { |
|
98 | 102 | $result .= $this->renderUses($indentLevel + $indentShift) . "\n\n"; |
99 | 103 | } |
100 | 104 | |
101 | 105 | $result .= $this->elements->render($indentLevel + $indentShift); |
102 | 106 | |
103 | - if (!empty($this->getName())) { |
|
107 | + if (!empty($this->getName())) |
|
108 | + { |
|
104 | 109 | $result .= "\n" . $this->addIndent('}', $indentLevel); |
105 | 110 | } |
106 | 111 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function addElement(DeclarationInterface $element): FileDeclaration |
107 | 107 | { |
108 | 108 | $this->elements->add($element); |
109 | - if ($element instanceof DependedInterface) { |
|
109 | + if ($element instanceof DependedInterface){ |
|
110 | 110 | $this->addUses($element->getDependencies()); |
111 | 111 | } |
112 | 112 | |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | { |
133 | 133 | $result = "<?php\n"; |
134 | 134 | |
135 | - if (!$this->docComment->isEmpty()) { |
|
136 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
135 | + if (!$this->docComment->isEmpty()){ |
|
136 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
137 | 137 | } |
138 | 138 | |
139 | - if ($this->directives !== null && !empty($this->directives->render())) { |
|
140 | - $result .= $this->directives->render() . "\n\n"; |
|
139 | + if ($this->directives !== null && !empty($this->directives->render())){ |
|
140 | + $result .= $this->directives->render()."\n\n"; |
|
141 | 141 | } |
142 | 142 | |
143 | - if (!empty($this->namespace)) { |
|
144 | - if ($this->docComment->isEmpty()) { |
|
143 | + if (!empty($this->namespace)){ |
|
144 | + if ($this->docComment->isEmpty()){ |
|
145 | 145 | $result .= "\n"; |
146 | 146 | } |
147 | 147 | $result .= "namespace {$this->namespace};\n\n"; |
148 | 148 | } |
149 | 149 | |
150 | - if (!empty($this->uses)) { |
|
151 | - $result .= $this->renderUses($indentLevel) . "\n\n"; |
|
150 | + if (!empty($this->uses)){ |
|
151 | + $result .= $this->renderUses($indentLevel)."\n\n"; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $result .= $this->elements->render($indentLevel); |
@@ -106,7 +106,8 @@ discard block |
||
106 | 106 | public function addElement(DeclarationInterface $element): FileDeclaration |
107 | 107 | { |
108 | 108 | $this->elements->add($element); |
109 | - if ($element instanceof DependedInterface) { |
|
109 | + if ($element instanceof DependedInterface) |
|
110 | + { |
|
110 | 111 | $this->addUses($element->getDependencies()); |
111 | 112 | } |
112 | 113 | |
@@ -132,22 +133,27 @@ discard block |
||
132 | 133 | { |
133 | 134 | $result = "<?php\n"; |
134 | 135 | |
135 | - if (!$this->docComment->isEmpty()) { |
|
136 | + if (!$this->docComment->isEmpty()) |
|
137 | + { |
|
136 | 138 | $result .= $this->docComment->render($indentLevel) . "\n"; |
137 | 139 | } |
138 | 140 | |
139 | - if ($this->directives !== null && !empty($this->directives->render())) { |
|
141 | + if ($this->directives !== null && !empty($this->directives->render())) |
|
142 | + { |
|
140 | 143 | $result .= $this->directives->render() . "\n\n"; |
141 | 144 | } |
142 | 145 | |
143 | - if (!empty($this->namespace)) { |
|
144 | - if ($this->docComment->isEmpty()) { |
|
146 | + if (!empty($this->namespace)) |
|
147 | + { |
|
148 | + if ($this->docComment->isEmpty()) |
|
149 | + { |
|
145 | 150 | $result .= "\n"; |
146 | 151 | } |
147 | 152 | $result .= "namespace {$this->namespace};\n\n"; |
148 | 153 | } |
149 | 154 | |
150 | - if (!empty($this->uses)) { |
|
155 | + if (!empty($this->uses)) |
|
156 | + { |
|
151 | 157 | $result .= $this->renderUses($indentLevel) . "\n\n"; |
152 | 158 | } |
153 | 159 |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setComment($comment): self |
44 | 44 | { |
45 | - if (!empty($comment)) { |
|
46 | - if (is_array($comment)) { |
|
45 | + if (!empty($comment)){ |
|
46 | + if (is_array($comment)){ |
|
47 | 47 | $this->docComment->setLines($comment); |
48 | - } elseif (is_string($comment)) { |
|
48 | + } elseif (is_string($comment)){ |
|
49 | 49 | $this->docComment->setString($comment); |
50 | 50 | } |
51 | 51 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function initComment($comment): void |
62 | 62 | { |
63 | - if (empty($this->docComment)) { |
|
63 | + if (empty($this->docComment)){ |
|
64 | 64 | $this->docComment = new Comment(); |
65 | 65 | } |
66 | 66 |
@@ -42,10 +42,14 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function setComment($comment): self |
44 | 44 | { |
45 | - if (!empty($comment)) { |
|
46 | - if (is_array($comment)) { |
|
45 | + if (!empty($comment)) |
|
46 | + { |
|
47 | + if (is_array($comment)) |
|
48 | + { |
|
47 | 49 | $this->docComment->setLines($comment); |
48 | - } elseif (is_string($comment)) { |
|
50 | + } |
|
51 | + elseif (is_string($comment)) |
|
52 | + { |
|
49 | 53 | $this->docComment->setString($comment); |
50 | 54 | } |
51 | 55 | } |
@@ -60,7 +64,8 @@ discard block |
||
60 | 64 | */ |
61 | 65 | private function initComment($comment): void |
62 | 66 | { |
63 | - if (empty($this->docComment)) { |
|
67 | + if (empty($this->docComment)) |
|
68 | + { |
|
64 | 69 | $this->docComment = new Comment(); |
65 | 70 | } |
66 | 71 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function addUses(array $uses): self |
58 | 58 | { |
59 | - foreach ($uses as $class => $alias) { |
|
59 | + foreach ($uses as $class => $alias){ |
|
60 | 60 | $this->addUse($class, $alias); |
61 | 61 | } |
62 | 62 | |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | private function renderUses(int $indentLevel = 0): string |
113 | 113 | { |
114 | 114 | $lines = []; |
115 | - foreach ($this->getUses() as $class => $alias) { |
|
115 | + foreach ($this->getUses() as $class => $alias){ |
|
116 | 116 | $line = "use {$class}"; |
117 | 117 | |
118 | - if (!empty($alias)) { |
|
118 | + if (!empty($alias)){ |
|
119 | 119 | $line .= " as {$alias};"; |
120 | - } else { |
|
120 | + }else{ |
|
121 | 121 | $line .= ';'; |
122 | 122 | } |
123 | 123 |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function addUses(array $uses): self |
58 | 58 | { |
59 | - foreach ($uses as $class => $alias) { |
|
59 | + foreach ($uses as $class => $alias) |
|
60 | + { |
|
60 | 61 | $this->addUse($class, $alias); |
61 | 62 | } |
62 | 63 | |
@@ -112,12 +113,16 @@ discard block |
||
112 | 113 | private function renderUses(int $indentLevel = 0): string |
113 | 114 | { |
114 | 115 | $lines = []; |
115 | - foreach ($this->getUses() as $class => $alias) { |
|
116 | + foreach ($this->getUses() as $class => $alias) |
|
117 | + { |
|
116 | 118 | $line = "use {$class}"; |
117 | 119 | |
118 | - if (!empty($alias)) { |
|
120 | + if (!empty($alias)) |
|
121 | + { |
|
119 | 122 | $line .= " as {$alias};"; |
120 | - } else { |
|
123 | + } |
|
124 | + else |
|
125 | + { |
|
121 | 126 | $line .= ';'; |
122 | 127 | } |
123 | 128 |
@@ -38,12 +38,14 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function render(int $indentLevel = 0): string |
40 | 40 | { |
41 | - if ($this->isEmpty()) { |
|
41 | + if ($this->isEmpty()) |
|
42 | + { |
|
42 | 43 | return ''; |
43 | 44 | } |
44 | 45 | |
45 | 46 | $result = $this->addIndent("/**\n", $indentLevel); |
46 | - foreach ($this->getLines() as $line) { |
|
47 | + foreach ($this->getLines() as $line) |
|
48 | + { |
|
47 | 49 | $result .= $this->addIndent(" * {$line}\n", $indentLevel); |
48 | 50 | } |
49 | 51 | |
@@ -58,7 +60,8 @@ discard block |
||
58 | 60 | protected function prepareLine(string $line): ?string |
59 | 61 | { |
60 | 62 | $line = trim($line); |
61 | - if (in_array($line, ['/*', '/**', '*/'], true)) { |
|
63 | + if (in_array($line, ['/*', '/**', '*/'], true)) |
|
64 | + { |
|
62 | 65 | return null; |
63 | 66 | } |
64 | 67 |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function render(int $indentLevel = 0): string |
39 | 39 | { |
40 | - if ($this->isEmpty()) { |
|
40 | + if ($this->isEmpty()){ |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $result = $this->addIndent("/**\n", $indentLevel); |
45 | - foreach ($this->getLines() as $line) { |
|
45 | + foreach ($this->getLines() as $line){ |
|
46 | 46 | $result .= $this->addIndent(" * {$line}\n", $indentLevel); |
47 | 47 | } |
48 | 48 | |
49 | - return $result . $this->addIndent(' */', $indentLevel); |
|
49 | + return $result.$this->addIndent(' */', $indentLevel); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | protected function prepareLine(string $line): ?string |
56 | 56 | { |
57 | 57 | $line = trim($line); |
58 | - if (in_array($line, ['/*', '/**', '*/'], true)) { |
|
58 | + if (in_array($line, ['/*', '/**', '*/'], true)){ |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 |
@@ -89,18 +89,18 @@ discard block |
||
89 | 89 | public function render(int $indentLevel = 0): string |
90 | 90 | { |
91 | 91 | $result = ''; |
92 | - if (!$this->docComment->isEmpty()) { |
|
93 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
92 | + if (!$this->docComment->isEmpty()){ |
|
93 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $result .= $this->addIndent("{$this->access} const {$this->getName()} = ", $indentLevel); |
97 | 97 | |
98 | 98 | $value = $this->getSerializer()->serialize($this->value); |
99 | - if (is_array($this->value)) { |
|
99 | + if (is_array($this->value)){ |
|
100 | 100 | $value = $this->mountIndents($value, $indentLevel); |
101 | 101 | } |
102 | 102 | |
103 | - return $result . "{$value};"; |
|
103 | + return $result."{$value};"; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | private function mountIndents(string $serialized, int $indentLevel): string |
114 | 114 | { |
115 | 115 | $lines = explode("\n", $serialized); |
116 | - foreach ($lines as &$line) { |
|
116 | + foreach ($lines as &$line){ |
|
117 | 117 | $line = $this->addIndent($line, $indentLevel); |
118 | 118 | unset($line); |
119 | 119 | } |
@@ -89,14 +89,16 @@ discard block |
||
89 | 89 | public function render(int $indentLevel = 0): string |
90 | 90 | { |
91 | 91 | $result = ''; |
92 | - if (!$this->docComment->isEmpty()) { |
|
92 | + if (!$this->docComment->isEmpty()) |
|
93 | + { |
|
93 | 94 | $result .= $this->docComment->render($indentLevel) . "\n"; |
94 | 95 | } |
95 | 96 | |
96 | 97 | $result .= $this->addIndent("{$this->access} const {$this->getName()} = ", $indentLevel); |
97 | 98 | |
98 | 99 | $value = $this->getSerializer()->serialize($this->value); |
99 | - if (is_array($this->value)) { |
|
100 | + if (is_array($this->value)) |
|
101 | + { |
|
100 | 102 | $value = $this->mountIndents($value, $indentLevel); |
101 | 103 | } |
102 | 104 | |
@@ -113,7 +115,8 @@ discard block |
||
113 | 115 | private function mountIndents(string $serialized, int $indentLevel): string |
114 | 116 | { |
115 | 117 | $lines = explode("\n", $serialized); |
116 | - foreach ($lines as &$line) { |
|
118 | + foreach ($lines as &$line) |
|
119 | + { |
|
117 | 120 | $line = $this->addIndent($line, $indentLevel); |
118 | 121 | unset($line); |
119 | 122 | } |
@@ -148,16 +148,16 @@ |
||
148 | 148 | public function render(int $indentLevel = 0): string |
149 | 149 | { |
150 | 150 | $type = ''; |
151 | - if (!empty($this->type)) { |
|
152 | - $type = $this->type . ' '; |
|
151 | + if (!empty($this->type)){ |
|
152 | + $type = $this->type.' '; |
|
153 | 153 | } |
154 | 154 | |
155 | - $result = $type . ($this->pdb ? '&' : '') . '$' . $this->getName(); |
|
155 | + $result = $type.($this->pdb ? '&' : '').'$'.$this->getName(); |
|
156 | 156 | |
157 | - if (!$this->isOptional) { |
|
157 | + if (!$this->isOptional){ |
|
158 | 158 | return $result; |
159 | 159 | } |
160 | 160 | |
161 | - return $result . ' = ' . $this->getSerializer()->serialize($this->defaultValue); |
|
161 | + return $result.' = '.$this->getSerializer()->serialize($this->defaultValue); |
|
162 | 162 | } |
163 | 163 | } |
@@ -148,13 +148,15 @@ |
||
148 | 148 | public function render(int $indentLevel = 0): string |
149 | 149 | { |
150 | 150 | $type = ''; |
151 | - if (!empty($this->type)) { |
|
151 | + if (!empty($this->type)) |
|
152 | + { |
|
152 | 153 | $type = $this->type . ' '; |
153 | 154 | } |
154 | 155 | |
155 | 156 | $result = $type . ($this->pdb ? '&' : '') . '$' . $this->getName(); |
156 | 157 | |
157 | - if (!$this->isOptional) { |
|
158 | + if (!$this->isOptional) |
|
159 | + { |
|
158 | 160 | return $result; |
159 | 161 | } |
160 | 162 |
@@ -31,10 +31,10 @@ |
||
31 | 31 | */ |
32 | 32 | public function render(int $indentLevel = 0): string |
33 | 33 | { |
34 | - if (empty($this->directives)) { |
|
34 | + if (empty($this->directives)){ |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | |
38 | - return 'declare(' . implode(', ', $this->directives) . ');'; |
|
38 | + return 'declare('.implode(', ', $this->directives).');'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -31,7 +31,8 @@ |
||
31 | 31 | */ |
32 | 32 | public function render(int $indentLevel = 0): string |
33 | 33 | { |
34 | - if (empty($this->directives)) { |
|
34 | + if (empty($this->directives)) |
|
35 | + { |
|
35 | 36 | return ''; |
36 | 37 | } |
37 | 38 |
@@ -101,10 +101,14 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function setSource($source): Method |
103 | 103 | { |
104 | - if (!empty($source)) { |
|
105 | - if (is_array($source)) { |
|
104 | + if (!empty($source)) |
|
105 | + { |
|
106 | + if (is_array($source)) |
|
107 | + { |
|
106 | 108 | $this->source->setLines($source); |
107 | - } elseif (is_string($source)) { |
|
109 | + } |
|
110 | + elseif (is_string($source)) |
|
111 | + { |
|
108 | 112 | $this->source->setString($source); |
109 | 113 | } |
110 | 114 | } |
@@ -147,25 +151,31 @@ discard block |
||
147 | 151 | public function render(int $indentLevel = 0): string |
148 | 152 | { |
149 | 153 | $result = ''; |
150 | - if (!$this->docComment->isEmpty()) { |
|
154 | + if (!$this->docComment->isEmpty()) |
|
155 | + { |
|
151 | 156 | $result .= $this->docComment->render($indentLevel) . "\n"; |
152 | 157 | } |
153 | 158 | |
154 | 159 | $method = $this->renderModifiers(); |
155 | - if (!$this->parameters->isEmpty()) { |
|
160 | + if (!$this->parameters->isEmpty()) |
|
161 | + { |
|
156 | 162 | $method .= "({$this->parameters->render()})"; |
157 | - } else { |
|
163 | + } |
|
164 | + else |
|
165 | + { |
|
158 | 166 | $method .= '()'; |
159 | 167 | } |
160 | 168 | |
161 | - if ($this->return) { |
|
169 | + if ($this->return) |
|
170 | + { |
|
162 | 171 | $method .= ": {$this->return}"; |
163 | 172 | } |
164 | 173 | |
165 | 174 | $result .= $this->addIndent($method, $indentLevel) . "\n"; |
166 | 175 | $result .= $this->addIndent('{', $indentLevel) . "\n"; |
167 | 176 | |
168 | - if (!$this->source->isEmpty()) { |
|
177 | + if (!$this->source->isEmpty()) |
|
178 | + { |
|
169 | 179 | $result .= $this->source->render($indentLevel + 1) . "\n"; |
170 | 180 | } |
171 | 181 | |
@@ -181,7 +191,8 @@ discard block |
||
181 | 191 | { |
182 | 192 | $chunks = [$this->getAccess()]; |
183 | 193 | |
184 | - if ($this->isStatic()) { |
|
194 | + if ($this->isStatic()) |
|
195 | + { |
|
185 | 196 | $chunks[] = 'static'; |
186 | 197 | } |
187 | 198 | |
@@ -197,14 +208,19 @@ discard block |
||
197 | 208 | */ |
198 | 209 | private function initSource($source): void |
199 | 210 | { |
200 | - if (empty($this->source)) { |
|
211 | + if (empty($this->source)) |
|
212 | + { |
|
201 | 213 | $this->source = new Source(); |
202 | 214 | } |
203 | 215 | |
204 | - if (!empty($source)) { |
|
205 | - if (is_array($source)) { |
|
216 | + if (!empty($source)) |
|
217 | + { |
|
218 | + if (is_array($source)) |
|
219 | + { |
|
206 | 220 | $this->source->setLines($source); |
207 | - } elseif (is_string($source)) { |
|
221 | + } |
|
222 | + elseif (is_string($source)) |
|
223 | + { |
|
208 | 224 | $this->source->setString($source); |
209 | 225 | } |
210 | 226 | } |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setSource($source): Method |
88 | 88 | { |
89 | - if (!empty($source)) { |
|
90 | - if (is_array($source)) { |
|
89 | + if (!empty($source)){ |
|
90 | + if (is_array($source)){ |
|
91 | 91 | $this->source->setLines($source); |
92 | - } elseif (is_string($source)) { |
|
92 | + } elseif (is_string($source)){ |
|
93 | 93 | $this->source->setString($source); |
94 | 94 | } |
95 | 95 | } |
@@ -123,36 +123,36 @@ discard block |
||
123 | 123 | public function render(int $indentLevel = 0): string |
124 | 124 | { |
125 | 125 | $result = ''; |
126 | - if (!$this->docComment->isEmpty()) { |
|
127 | - $result .= $this->docComment->render($indentLevel) . "\n"; |
|
126 | + if (!$this->docComment->isEmpty()){ |
|
127 | + $result .= $this->docComment->render($indentLevel)."\n"; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $method = $this->renderModifiers(); |
131 | - if (!$this->parameters->isEmpty()) { |
|
131 | + if (!$this->parameters->isEmpty()){ |
|
132 | 132 | $method .= "({$this->parameters->render()})"; |
133 | - } else { |
|
133 | + }else{ |
|
134 | 134 | $method .= '()'; |
135 | 135 | } |
136 | 136 | |
137 | - if ($this->return) { |
|
137 | + if ($this->return){ |
|
138 | 138 | $method .= ": {$this->return}"; |
139 | 139 | } |
140 | 140 | |
141 | - $result .= $this->addIndent($method, $indentLevel) . "\n"; |
|
142 | - $result .= $this->addIndent('{', $indentLevel) . "\n"; |
|
141 | + $result .= $this->addIndent($method, $indentLevel)."\n"; |
|
142 | + $result .= $this->addIndent('{', $indentLevel)."\n"; |
|
143 | 143 | |
144 | - if (!$this->source->isEmpty()) { |
|
145 | - $result .= $this->source->render($indentLevel + 1) . "\n"; |
|
144 | + if (!$this->source->isEmpty()){ |
|
145 | + $result .= $this->source->render($indentLevel + 1)."\n"; |
|
146 | 146 | } |
147 | 147 | |
148 | - return $result . $this->addIndent('}', $indentLevel); |
|
148 | + return $result.$this->addIndent('}', $indentLevel); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | private function renderModifiers(): string |
152 | 152 | { |
153 | 153 | $chunks = [$this->getAccess()]; |
154 | 154 | |
155 | - if ($this->isStatic()) { |
|
155 | + if ($this->isStatic()){ |
|
156 | 156 | $chunks[] = 'static'; |
157 | 157 | } |
158 | 158 | |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | */ |
169 | 169 | private function initSource($source): void |
170 | 170 | { |
171 | - if (empty($this->source)) { |
|
171 | + if (empty($this->source)){ |
|
172 | 172 | $this->source = new Source(); |
173 | 173 | } |
174 | 174 | |
175 | - if (!empty($source)) { |
|
176 | - if (is_array($source)) { |
|
175 | + if (!empty($source)){ |
|
176 | + if (is_array($source)){ |
|
177 | 177 | $this->source->setLines($source); |
178 | - } elseif (is_string($source)) { |
|
178 | + } elseif (is_string($source)){ |
|
179 | 179 | $this->source->setString($source); |
180 | 180 | } |
181 | 181 | } |