Passed
Pull Request — master (#656)
by Abdul Malik
09:21
created
src/Session/src/Handler/FileHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
57 57
     #[ReturnTypeWillChange]
58 58
     public function gc($maxlifetime)
59 59
     {
60
-        foreach ($this->files->getFiles($this->directory) as $filename) {
61
-            if ($this->files->time($filename) < time() - $maxlifetime) {
60
+        foreach ($this->files->getFiles($this->directory) as $filename){
61
+            if ($this->files->time($filename) < time() - $maxlifetime){
62 62
                 $this->files->delete($filename);
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,10 @@
 block discarded – undo
57 57
     #[ReturnTypeWillChange]
58 58
     public function gc($maxlifetime)
59 59
     {
60
-        foreach ($this->files->getFiles($this->directory) as $filename) {
61
-            if ($this->files->time($filename) < time() - $maxlifetime) {
60
+        foreach ($this->files->getFiles($this->directory) as $filename)
61
+        {
62
+            if ($this->files->time($filename) < time() - $maxlifetime)
63
+            {
62 64
                 $this->files->delete($filename);
63 65
             }
64 66
         }
Please login to merge, or discard this patch.
src/Session/src/Session.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $this->clientSignature = $clientSignature;
62 62
         $this->lifetime = $lifetime;
63 63
 
64
-        if (!empty($id) && $this->validID($id)) {
64
+        if (!empty($id) && $this->validID($id)){
65 65
             $this->id = $id;
66 66
         }
67 67
     }
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function resume(): void
94 94
     {
95
-        if ($this->isStarted()) {
95
+        if ($this->isStarted()){
96 96
             return;
97 97
         }
98 98
 
99
-        if (!empty($this->id)) {
99
+        if (!empty($this->id)){
100 100
             session_id($this->id);
101
-        } else {
101
+        }else{
102 102
             // always new id
103 103
             session_id(session_create_id());
104 104
         }
105 105
 
106
-        try {
106
+        try{
107 107
             session_start(['use_cookies' => false]);
108
-        } catch (Throwable $e) {
108
+        }catch (Throwable $e){
109 109
             throw new SessionException('Unable to start session', $e->getCode(), $e);
110 110
         }
111 111
 
112
-        if (empty($this->id)) {
112
+        if (empty($this->id)){
113 113
             //Sign newly created session
114 114
             $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature;
115 115
             $_SESSION[self::SESSION_CREATED] = time();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $this->started = true;
121 121
 
122 122
         //Ensure that session is valid
123
-        if (!$this->validSession()) {
123
+        if (!$this->validSession()){
124 124
             $this->invalidateSession();
125 125
         }
126 126
     }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function commit(): bool
161 161
     {
162
-        if (!$this->isStarted()) {
162
+        if (!$this->isStarted()){
163 163
             return false;
164 164
         }
165 165
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function abort(): bool
176 176
     {
177
-        if (!$this->isStarted()) {
177
+        if (!$this->isStarted()){
178 178
             return false;
179 179
         }
180 180
 
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
         if (
216 216
             !array_key_exists(self::CLIENT_SIGNATURE, $_SESSION)
217 217
             || !array_key_exists(self::SESSION_CREATED, $_SESSION)
218
-        ) {
218
+        ){
219 219
             //Missing session signature or timestamp!
220 220
             return false;
221 221
         }
222 222
 
223
-        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime) {
223
+        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime){
224 224
             //Session expired
225 225
             return false;
226 226
         }
227 227
 
228
-        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)) {
228
+        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)){
229 229
             //Signatures do not match
230 230
             return false;
231 231
         }
Please login to merge, or discard this patch.
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,8 @@  discard block
 block discarded – undo
61 61
         $this->clientSignature = $clientSignature;
62 62
         $this->lifetime = $lifetime;
63 63
 
64
-        if (!empty($id) && $this->validID($id)) {
64
+        if (!empty($id) && $this->validID($id))
65
+        {
65 66
             $this->id = $id;
66 67
         }
67 68
     }
@@ -92,24 +93,32 @@  discard block
 block discarded – undo
92 93
      */
93 94
     public function resume(): void
94 95
     {
95
-        if ($this->isStarted()) {
96
+        if ($this->isStarted())
97
+        {
96 98
             return;
97 99
         }
98 100
 
99
-        if (!empty($this->id)) {
101
+        if (!empty($this->id))
102
+        {
100 103
             session_id($this->id);
101
-        } else {
104
+        }
105
+        else
106
+        {
102 107
             // always new id
103 108
             session_id(session_create_id());
104 109
         }
105 110
 
106
-        try {
111
+        try
112
+        {
107 113
             session_start(['use_cookies' => false]);
108
-        } catch (Throwable $e) {
114
+        }
115
+        catch (Throwable $e)
116
+        {
109 117
             throw new SessionException('Unable to start session', $e->getCode(), $e);
110 118
         }
111 119
 
112
-        if (empty($this->id)) {
120
+        if (empty($this->id))
121
+        {
113 122
             //Sign newly created session
114 123
             $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature;
115 124
             $_SESSION[self::SESSION_CREATED] = time();
@@ -120,7 +129,8 @@  discard block
 block discarded – undo
120 129
         $this->started = true;
121 130
 
122 131
         //Ensure that session is valid
123
-        if (!$this->validSession()) {
132
+        if (!$this->validSession())
133
+        {
124 134
             $this->invalidateSession();
125 135
         }
126 136
     }
@@ -159,7 +169,8 @@  discard block
 block discarded – undo
159 169
      */
160 170
     public function commit(): bool
161 171
     {
162
-        if (!$this->isStarted()) {
172
+        if (!$this->isStarted())
173
+        {
163 174
             return false;
164 175
         }
165 176
 
@@ -174,7 +185,8 @@  discard block
 block discarded – undo
174 185
      */
175 186
     public function abort(): bool
176 187
     {
177
-        if (!$this->isStarted()) {
188
+        if (!$this->isStarted())
189
+        {
178 190
             return false;
179 191
         }
180 192
 
@@ -220,12 +232,14 @@  discard block
 block discarded – undo
220 232
             return false;
221 233
         }
222 234
 
223
-        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime) {
235
+        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime)
236
+        {
224 237
             //Session expired
225 238
             return false;
226 239
         }
227 240
 
228
-        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)) {
241
+        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature))
242
+        {
229 243
             //Signatures do not match
230 244
             return false;
231 245
         }
Please login to merge, or discard this patch.
src/Session/src/SessionFactory.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@
 block discarded – undo
36 36
 
37 37
     public function initSession(string $clientSignature, string $id = null): SessionInterface
38 38
     {
39
-        if (session_status() === PHP_SESSION_ACTIVE) {
39
+        if (session_status() === PHP_SESSION_ACTIVE){
40 40
             throw new MultipleSessionException('Unable to initiate session, session already started');
41 41
         }
42 42
 
43 43
         // Initiating proper session handler
44
-        if ($this->config->getHandler() !== null) {
45
-            try {
44
+        if ($this->config->getHandler() !== null){
45
+            try{
46 46
                 $handler = $this->config->getHandler()->resolve($this->factory);
47
-            } catch (Throwable | ContainerExceptionInterface $e) {
47
+            }catch (Throwable | ContainerExceptionInterface $e){
48 48
                 throw new SessionException($e->getMessage(), $e->getCode(), $e);
49 49
             }
50 50
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,15 +36,20 @@
 block discarded – undo
36 36
 
37 37
     public function initSession(string $clientSignature, string $id = null): SessionInterface
38 38
     {
39
-        if (session_status() === PHP_SESSION_ACTIVE) {
39
+        if (session_status() === PHP_SESSION_ACTIVE)
40
+        {
40 41
             throw new MultipleSessionException('Unable to initiate session, session already started');
41 42
         }
42 43
 
43 44
         // Initiating proper session handler
44
-        if ($this->config->getHandler() !== null) {
45
-            try {
45
+        if ($this->config->getHandler() !== null)
46
+        {
47
+            try
48
+            {
46 49
                 $handler = $this->config->getHandler()->resolve($this->factory);
47
-            } catch (Throwable | ContainerExceptionInterface $e) {
50
+            }
51
+            catch (Throwable | ContainerExceptionInterface $e)
52
+            {
48 53
                 throw new SessionException($e->getMessage(), $e->getCode(), $e);
49 54
             }
50 55
 
Please login to merge, or discard this patch.
src/Dumper/src/System.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function isCLI(): bool
27 27
     {
28
-        if (!empty(getenv('RR'))) {
28
+        if (!empty(getenv('RR'))){
29 29
             // Do not treat RoadRunner as CLI.
30 30
             return false;
31 31
         }
32 32
 
33
-        if (php_sapi_name() === 'cli') {
33
+        if (php_sapi_name() === 'cli'){
34 34
             return true;
35 35
         }
36 36
 
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public static function isColorsSupported($stream = STDOUT): bool
48 48
     {
49
-        if ('Hyper' === getenv('TERM_PROGRAM')) {
49
+        if ('Hyper' === getenv('TERM_PROGRAM')){
50 50
             return true;
51 51
         }
52 52
 
53
-        try {
54
-            if (\DIRECTORY_SEPARATOR === '\\') {
53
+        try{
54
+            if (\DIRECTORY_SEPARATOR === '\\'){
55 55
                 return (
56 56
                         function_exists('sapi_windows_vt100_support')
57 57
                         && @sapi_windows_vt100_support($stream)
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             }
62 62
 
63 63
             return @stream_isatty($stream);
64
-        } catch (Throwable $e) {
64
+        }catch (Throwable $e){
65 65
             return false;
66 66
         }
67 67
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,14 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function isCLI(): bool
27 27
     {
28
-        if (!empty(getenv('RR'))) {
28
+        if (!empty(getenv('RR')))
29
+        {
29 30
             // Do not treat RoadRunner as CLI.
30 31
             return false;
31 32
         }
32 33
 
33
-        if (php_sapi_name() === 'cli') {
34
+        if (php_sapi_name() === 'cli')
35
+        {
34 36
             return true;
35 37
         }
36 38
 
@@ -46,12 +48,15 @@  discard block
 block discarded – undo
46 48
      */
47 49
     public static function isColorsSupported($stream = STDOUT): bool
48 50
     {
49
-        if ('Hyper' === getenv('TERM_PROGRAM')) {
51
+        if ('Hyper' === getenv('TERM_PROGRAM'))
52
+        {
50 53
             return true;
51 54
         }
52 55
 
53
-        try {
54
-            if (\DIRECTORY_SEPARATOR === '\\') {
56
+        try
57
+        {
58
+            if (\DIRECTORY_SEPARATOR === '\\')
59
+            {
55 60
                 return (
56 61
                         function_exists('sapi_windows_vt100_support')
57 62
                         && @sapi_windows_vt100_support($stream)
@@ -61,7 +66,9 @@  discard block
 block discarded – undo
61 66
             }
62 67
 
63 68
             return @stream_isatty($stream);
64
-        } catch (Throwable $e) {
69
+        }
70
+        catch (Throwable $e)
71
+        {
65 72
             return false;
66 73
         }
67 74
     }
Please login to merge, or discard this patch.
src/Dumper/src/Dumper.php 2 patches
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function __construct(LoggerInterface $logger = null)
64 64
     {
65
-        if ($logger !== null) {
65
+        if ($logger !== null){
66 66
             $this->setLogger($logger);
67 67
         }
68 68
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $r = $this->getRenderer($target);
89 89
         $dump = $r->wrapContent($this->renderValue($r, $value));
90 90
 
91
-        switch ($target) {
91
+        switch ($target){
92 92
             case self::OUTPUT:
93 93
                 echo $dump;
94 94
                 break;
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
                 return $dump;
99 99
 
100 100
             case self::LOGGER:
101
-                if ($this->logger === null) {
101
+                if ($this->logger === null){
102 102
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface.');
103 103
                 }
104
-                $this->logger->debug((string) $dump);
104
+                $this->logger->debug((string)$dump);
105 105
                 break;
106 106
 
107 107
             case self::ERROR_LOG:
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
121 121
     {
122
-        if (!isset($this->targets[$target])) {
122
+        if (!isset($this->targets[$target])){
123 123
             throw new DumperException(sprintf('Undefined dump target %d', $target));
124 124
         }
125 125
 
@@ -136,19 +136,19 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function getRenderer(int $target): RendererInterface
138 138
     {
139
-        if ($target == self::OUTPUT && System::isCLI()) {
140
-            if (System::isColorsSupported(STDOUT)) {
139
+        if ($target == self::OUTPUT && System::isCLI()){
140
+            if (System::isColorsSupported(STDOUT)){
141 141
                 $target = self::OUTPUT_CLI_COLORS;
142
-            } else {
142
+            }else{
143 143
                 $target = self::OUTPUT_CLI;
144 144
             }
145 145
         }
146 146
 
147
-        if (!isset($this->targets[$target])) {
147
+        if (!isset($this->targets[$target])){
148 148
             throw new DumperException(sprintf('Undefined dump target %d', $target));
149 149
         }
150 150
 
151
-        if (is_string($this->targets[$target])) {
151
+        if (is_string($this->targets[$target])){
152 152
             $this->targets[$target] = new $this->targets[$target]();
153 153
         }
154 154
 
@@ -171,32 +171,32 @@  discard block
 block discarded – undo
171 171
         int $level = 0,
172 172
         bool $hideHeader = false
173 173
     ): string {
174
-        if (!$hideHeader && !empty($name)) {
175
-            $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
176
-        } else {
174
+        if (!$hideHeader && !empty($name)){
175
+            $header = $r->indent($level).$r->apply($name, 'name').$r->apply(' = ', 'syntax', '=');
176
+        }else{
177 177
             $header = $r->indent($level);
178 178
         }
179 179
 
180
-        if ($level > $this->maxLevel) {
180
+        if ($level > $this->maxLevel){
181 181
             //Renderer is not reference based, we can't dump too deep values
182
-            return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
182
+            return $r->indent($level).$r->apply('-too deep-', 'maxLevel')."\n";
183 183
         }
184 184
 
185 185
         $type = strtolower(gettype($value));
186 186
 
187
-        if ($type === 'array') {
188
-            return $header . $this->renderArray($r, $value, $level, $hideHeader);
187
+        if ($type === 'array'){
188
+            return $header.$this->renderArray($r, $value, $level, $hideHeader);
189 189
         }
190 190
 
191
-        if ($type === 'object') {
192
-            return $header . $this->renderObject($r, $value, $level, $hideHeader);
191
+        if ($type === 'object'){
192
+            return $header.$this->renderObject($r, $value, $level, $hideHeader);
193 193
         }
194 194
 
195
-        if ($type === 'resource') {
195
+        if ($type === 'resource'){
196 196
             //No need to dump resource value
197
-            $element = get_resource_type($value) . ' resource ';
197
+            $element = get_resource_type($value).' resource ';
198 198
 
199
-            return $header . $r->apply($element, 'type', 'resource') . "\n";
199
+            return $header.$r->apply($element, 'type', 'resource')."\n";
200 200
         }
201 201
 
202 202
         //Value length
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $header .= $r->apply("{$type}({$length})", 'type', $type);
207 207
 
208 208
         $element = null;
209
-        switch ($type) {
209
+        switch ($type){
210 210
             case 'string':
211 211
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
212 212
                 break;
@@ -216,31 +216,31 @@  discard block
 block discarded – undo
216 216
                 break;
217 217
 
218 218
             default:
219
-                if ($value !== null) {
219
+                if ($value !== null){
220 220
                     //Not showing null value, type is enough
221 221
                     $element = var_export($value, true);
222 222
                 }
223 223
         }
224 224
 
225 225
         //Including value
226
-        return $header . ' ' . $r->apply($element, 'value', $type) . "\n";
226
+        return $header.' '.$r->apply($element, 'value', $type)."\n";
227 227
     }
228 228
 
229 229
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
230 230
     {
231
-        if (!$hideHeader) {
231
+        if (!$hideHeader){
232 232
             $count = count($array);
233 233
 
234 234
             //Array size and scope
235
-            $output = $r->apply("array({$count})", 'type', 'array') . "\n";
236
-            $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
237
-        } else {
235
+            $output = $r->apply("array({$count})", 'type', 'array')."\n";
236
+            $output .= $r->indent($level).$r->apply('[', 'syntax', '[')."\n";
237
+        }else{
238 238
             $output = '';
239 239
         }
240 240
 
241
-        foreach ($array as $key => $value) {
242
-            if (!is_numeric($key)) {
243
-                if (is_string($key) && $r->escapeStrings()) {
241
+        foreach ($array as $key => $value){
242
+            if (!is_numeric($key)){
243
+                if (is_string($key) && $r->escapeStrings()){
244 244
                     $key = htmlspecialchars($key);
245 245
                 }
246 246
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
251 251
         }
252 252
 
253
-        if (!$hideHeader) {
253
+        if (!$hideHeader){
254 254
             //Closing array scope
255
-            $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
255
+            $output .= $r->indent($level).$r->apply(']', 'syntax', ']')."\n";
256 256
         }
257 257
 
258 258
         return $output;
@@ -269,47 +269,47 @@  discard block
 block discarded – undo
269 269
         bool $hideHeader = false,
270 270
         string $class = ''
271 271
     ): string {
272
-        if (!$hideHeader) {
273
-            $type = ($class ?: get_class($value)) . ' object ';
272
+        if (!$hideHeader){
273
+            $type = ($class ?: get_class($value)).' object ';
274 274
 
275
-            $header = $r->apply($type, 'type', 'object') . "\n";
276
-            $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
277
-        } else {
275
+            $header = $r->apply($type, 'type', 'object')."\n";
276
+            $header .= $r->indent($level).$r->apply('(', 'syntax', '(')."\n";
277
+        }else{
278 278
             $header = '';
279 279
         }
280 280
 
281 281
         //Let's use method specifically created for dumping
282
-        if (method_exists($value, '__debugInfo') || $value instanceof Closure) {
283
-            if ($value instanceof Closure) {
282
+        if (method_exists($value, '__debugInfo') || $value instanceof Closure){
283
+            if ($value instanceof Closure){
284 284
                 $debugInfo = $this->describeClosure($value);
285
-            } else {
285
+            }else{
286 286
                 $debugInfo = $value->__debugInfo();
287 287
             }
288 288
 
289
-            if (is_array($debugInfo)) {
289
+            if (is_array($debugInfo)){
290 290
                 //Pretty view
291 291
                 $debugInfo = (object)$debugInfo;
292 292
             }
293 293
 
294
-            if (is_object($debugInfo)) {
294
+            if (is_object($debugInfo)){
295 295
                 //We are not including syntax elements here
296 296
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
297 297
             }
298 298
 
299 299
             return $header
300 300
                 . $this->renderValue($r, $debugInfo, '', $level + (is_scalar($value)), true)
301
-                . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
301
+                . $r->indent($level).$r->apply(')', 'syntax', ')')."\n";
302 302
         }
303 303
 
304 304
         $refection = new ReflectionObject($value);
305 305
 
306 306
         $output = '';
307
-        foreach ($refection->getProperties() as $property) {
307
+        foreach ($refection->getProperties() as $property){
308 308
             $output .= $this->renderProperty($r, $value, $property, $level);
309 309
         }
310 310
 
311 311
         //Header, content, footer
312
-        return $header . $output . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
312
+        return $header.$output.$r->indent($level).$r->apply(')', 'syntax', ')')."\n";
313 313
     }
314 314
 
315 315
     /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     private function renderProperty(RendererInterface $r, $value, ReflectionProperty $p, int $level): string
320 320
     {
321
-        if ($p->isStatic()) {
321
+        if ($p->isStatic()){
322 322
             return '';
323 323
         }
324 324
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             !($value instanceof stdClass)
327 327
             && is_string($p->getDocComment())
328 328
             && strpos($p->getDocComment(), '@internal') !== false
329
-        ) {
329
+        ){
330 330
             // Memory loop while reading doc comment for stdClass variables?
331 331
             // Report a PHP bug about treating comment INSIDE property declaration as doc comment.
332 332
             return '';
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
         //To read private and protected properties
339 339
         $p->setAccessible(true);
340 340
 
341
-        if ($value instanceof stdClass) {
341
+        if ($value instanceof stdClass){
342 342
             $name = $r->apply($p->getName(), 'dynamic');
343
-        } else {
343
+        }else{
344 344
             //Property name includes access level
345
-            $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
345
+            $name = $p->getName().$r->apply(':'.$access, 'access', $access);
346 346
         }
347 347
 
348 348
         return $this->renderValue($r, $p->getValue($value), $name, $level + 1);
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
      */
354 354
     private function describeClosure(Closure $closure): array
355 355
     {
356
-        try {
356
+        try{
357 357
             $r = new ReflectionFunction($closure);
358
-        } catch (ReflectionException $e) {
358
+        }catch (ReflectionException $e){
359 359
             return ['closure' => 'unable to resolve'];
360 360
         }
361 361
 
362 362
         return [
363
-            'name' => $r->getName() . " (lines {$r->getStartLine()}:{$r->getEndLine()})",
363
+            'name' => $r->getName()." (lines {$r->getStartLine()}:{$r->getEndLine()})",
364 364
             'file' => $r->getFileName(),
365 365
             'this' => $r->getClosureThis(),
366 366
         ];
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
      */
374 374
     private function getAccess(ReflectionProperty $p): string
375 375
     {
376
-        if ($p->isPrivate()) {
376
+        if ($p->isPrivate()){
377 377
             return 'private';
378
-        } elseif ($p->isProtected()) {
378
+        } elseif ($p->isProtected()){
379 379
             return 'protected';
380 380
         }
381 381
 
Please login to merge, or discard this patch.
Braces   +84 added lines, -38 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function __construct(LoggerInterface $logger = null)
64 64
     {
65
-        if ($logger !== null) {
65
+        if ($logger !== null)
66
+        {
66 67
             $this->setLogger($logger);
67 68
         }
68 69
     }
@@ -88,7 +89,8 @@  discard block
 block discarded – undo
88 89
         $r = $this->getRenderer($target);
89 90
         $dump = $r->wrapContent($this->renderValue($r, $value));
90 91
 
91
-        switch ($target) {
92
+        switch ($target)
93
+        {
92 94
             case self::OUTPUT:
93 95
                 echo $dump;
94 96
                 break;
@@ -98,7 +100,8 @@  discard block
 block discarded – undo
98 100
                 return $dump;
99 101
 
100 102
             case self::LOGGER:
101
-                if ($this->logger === null) {
103
+                if ($this->logger === null)
104
+                {
102 105
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface.');
103 106
                 }
104 107
                 $this->logger->debug((string) $dump);
@@ -119,7 +122,8 @@  discard block
 block discarded – undo
119 122
      */
120 123
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
121 124
     {
122
-        if (!isset($this->targets[$target])) {
125
+        if (!isset($this->targets[$target]))
126
+        {
123 127
             throw new DumperException(sprintf('Undefined dump target %d', $target));
124 128
         }
125 129
 
@@ -136,19 +140,25 @@  discard block
 block discarded – undo
136 140
      */
137 141
     private function getRenderer(int $target): RendererInterface
138 142
     {
139
-        if ($target == self::OUTPUT && System::isCLI()) {
140
-            if (System::isColorsSupported(STDOUT)) {
143
+        if ($target == self::OUTPUT && System::isCLI())
144
+        {
145
+            if (System::isColorsSupported(STDOUT))
146
+            {
141 147
                 $target = self::OUTPUT_CLI_COLORS;
142
-            } else {
148
+            }
149
+            else
150
+            {
143 151
                 $target = self::OUTPUT_CLI;
144 152
             }
145 153
         }
146 154
 
147
-        if (!isset($this->targets[$target])) {
155
+        if (!isset($this->targets[$target]))
156
+        {
148 157
             throw new DumperException(sprintf('Undefined dump target %d', $target));
149 158
         }
150 159
 
151
-        if (is_string($this->targets[$target])) {
160
+        if (is_string($this->targets[$target]))
161
+        {
152 162
             $this->targets[$target] = new $this->targets[$target]();
153 163
         }
154 164
 
@@ -171,28 +181,35 @@  discard block
 block discarded – undo
171 181
         int $level = 0,
172 182
         bool $hideHeader = false
173 183
     ): string {
174
-        if (!$hideHeader && !empty($name)) {
184
+        if (!$hideHeader && !empty($name))
185
+        {
175 186
             $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
176
-        } else {
187
+        }
188
+        else
189
+        {
177 190
             $header = $r->indent($level);
178 191
         }
179 192
 
180
-        if ($level > $this->maxLevel) {
193
+        if ($level > $this->maxLevel)
194
+        {
181 195
             //Renderer is not reference based, we can't dump too deep values
182 196
             return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
183 197
         }
184 198
 
185 199
         $type = strtolower(gettype($value));
186 200
 
187
-        if ($type === 'array') {
201
+        if ($type === 'array')
202
+        {
188 203
             return $header . $this->renderArray($r, $value, $level, $hideHeader);
189 204
         }
190 205
 
191
-        if ($type === 'object') {
206
+        if ($type === 'object')
207
+        {
192 208
             return $header . $this->renderObject($r, $value, $level, $hideHeader);
193 209
         }
194 210
 
195
-        if ($type === 'resource') {
211
+        if ($type === 'resource')
212
+        {
196 213
             //No need to dump resource value
197 214
             $element = get_resource_type($value) . ' resource ';
198 215
 
@@ -206,7 +223,8 @@  discard block
 block discarded – undo
206 223
         $header .= $r->apply("{$type}({$length})", 'type', $type);
207 224
 
208 225
         $element = null;
209
-        switch ($type) {
226
+        switch ($type)
227
+        {
210 228
             case 'string':
211 229
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
212 230
                 break;
@@ -216,7 +234,8 @@  discard block
 block discarded – undo
216 234
                 break;
217 235
 
218 236
             default:
219
-                if ($value !== null) {
237
+                if ($value !== null)
238
+                {
220 239
                     //Not showing null value, type is enough
221 240
                     $element = var_export($value, true);
222 241
                 }
@@ -228,19 +247,25 @@  discard block
 block discarded – undo
228 247
 
229 248
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
230 249
     {
231
-        if (!$hideHeader) {
250
+        if (!$hideHeader)
251
+        {
232 252
             $count = count($array);
233 253
 
234 254
             //Array size and scope
235 255
             $output = $r->apply("array({$count})", 'type', 'array') . "\n";
236 256
             $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
237
-        } else {
257
+        }
258
+        else
259
+        {
238 260
             $output = '';
239 261
         }
240 262
 
241
-        foreach ($array as $key => $value) {
242
-            if (!is_numeric($key)) {
243
-                if (is_string($key) && $r->escapeStrings()) {
263
+        foreach ($array as $key => $value)
264
+        {
265
+            if (!is_numeric($key))
266
+            {
267
+                if (is_string($key) && $r->escapeStrings())
268
+                {
244 269
                     $key = htmlspecialchars($key);
245 270
                 }
246 271
 
@@ -250,7 +275,8 @@  discard block
 block discarded – undo
250 275
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
251 276
         }
252 277
 
253
-        if (!$hideHeader) {
278
+        if (!$hideHeader)
279
+        {
254 280
             //Closing array scope
255 281
             $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
256 282
         }
@@ -269,29 +295,38 @@  discard block
 block discarded – undo
269 295
         bool $hideHeader = false,
270 296
         string $class = ''
271 297
     ): string {
272
-        if (!$hideHeader) {
298
+        if (!$hideHeader)
299
+        {
273 300
             $type = ($class ?: get_class($value)) . ' object ';
274 301
 
275 302
             $header = $r->apply($type, 'type', 'object') . "\n";
276 303
             $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
277
-        } else {
304
+        }
305
+        else
306
+        {
278 307
             $header = '';
279 308
         }
280 309
 
281 310
         //Let's use method specifically created for dumping
282
-        if (method_exists($value, '__debugInfo') || $value instanceof Closure) {
283
-            if ($value instanceof Closure) {
311
+        if (method_exists($value, '__debugInfo') || $value instanceof Closure)
312
+        {
313
+            if ($value instanceof Closure)
314
+            {
284 315
                 $debugInfo = $this->describeClosure($value);
285
-            } else {
316
+            }
317
+            else
318
+            {
286 319
                 $debugInfo = $value->__debugInfo();
287 320
             }
288 321
 
289
-            if (is_array($debugInfo)) {
322
+            if (is_array($debugInfo))
323
+            {
290 324
                 //Pretty view
291 325
                 $debugInfo = (object)$debugInfo;
292 326
             }
293 327
 
294
-            if (is_object($debugInfo)) {
328
+            if (is_object($debugInfo))
329
+            {
295 330
                 //We are not including syntax elements here
296 331
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
297 332
             }
@@ -304,7 +339,8 @@  discard block
 block discarded – undo
304 339
         $refection = new ReflectionObject($value);
305 340
 
306 341
         $output = '';
307
-        foreach ($refection->getProperties() as $property) {
342
+        foreach ($refection->getProperties() as $property)
343
+        {
308 344
             $output .= $this->renderProperty($r, $value, $property, $level);
309 345
         }
310 346
 
@@ -318,7 +354,8 @@  discard block
 block discarded – undo
318 354
      */
319 355
     private function renderProperty(RendererInterface $r, $value, ReflectionProperty $p, int $level): string
320 356
     {
321
-        if ($p->isStatic()) {
357
+        if ($p->isStatic())
358
+        {
322 359
             return '';
323 360
         }
324 361
 
@@ -338,9 +375,12 @@  discard block
 block discarded – undo
338 375
         //To read private and protected properties
339 376
         $p->setAccessible(true);
340 377
 
341
-        if ($value instanceof stdClass) {
378
+        if ($value instanceof stdClass)
379
+        {
342 380
             $name = $r->apply($p->getName(), 'dynamic');
343
-        } else {
381
+        }
382
+        else
383
+        {
344 384
             //Property name includes access level
345 385
             $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
346 386
         }
@@ -353,9 +393,12 @@  discard block
 block discarded – undo
353 393
      */
354 394
     private function describeClosure(Closure $closure): array
355 395
     {
356
-        try {
396
+        try
397
+        {
357 398
             $r = new ReflectionFunction($closure);
358
-        } catch (ReflectionException $e) {
399
+        }
400
+        catch (ReflectionException $e)
401
+        {
359 402
             return ['closure' => 'unable to resolve'];
360 403
         }
361 404
 
@@ -373,9 +416,12 @@  discard block
 block discarded – undo
373 416
      */
374 417
     private function getAccess(ReflectionProperty $p): string
375 418
     {
376
-        if ($p->isPrivate()) {
419
+        if ($p->isPrivate())
420
+        {
377 421
             return 'private';
378
-        } elseif ($p->isProtected()) {
422
+        }
423
+        elseif ($p->isProtected())
424
+        {
379 425
             return 'protected';
380 426
         }
381 427
 
Please login to merge, or discard this patch.
src/Dumper/src/helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Spiral\Core\ContainerScope;
13 13
 use Spiral\Debug\Dumper;
14 14
 
15
-if (!function_exists('dump')) {
15
+if (!function_exists('dump')){
16 16
     /**
17 17
      * Dump value.
18 18
      *
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
      */
24 24
     function dump($value, int $output = Dumper::OUTPUT): ?string
25 25
     {
26
-        if (!class_exists(ContainerScope::class)) {
26
+        if (!class_exists(ContainerScope::class)){
27 27
             return (new Dumper())->dump($value, $output);
28 28
         }
29 29
 
30 30
         $container = ContainerScope::getContainer();
31
-        if (is_null($container) || !$container->has(Dumper::class)) {
31
+        if (is_null($container) || !$container->has(Dumper::class)){
32 32
             $dumper = new Dumper();
33 33
 
34 34
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
 use Spiral\Core\ContainerScope;
13 13
 use Spiral\Debug\Dumper;
14 14
 
15
-if (!function_exists('dump')) {
15
+if (!function_exists('dump'))
16
+{
16 17
     /**
17 18
      * Dump value.
18 19
      *
@@ -23,12 +24,14 @@  discard block
 block discarded – undo
23 24
      */
24 25
     function dump($value, int $output = Dumper::OUTPUT): ?string
25 26
     {
26
-        if (!class_exists(ContainerScope::class)) {
27
+        if (!class_exists(ContainerScope::class))
28
+        {
27 29
             return (new Dumper())->dump($value, $output);
28 30
         }
29 31
 
30 32
         $container = ContainerScope::getContainer();
31
-        if (is_null($container) || !$container->has(Dumper::class)) {
33
+        if (is_null($container) || !$container->has(Dumper::class))
34
+        {
32 35
             $dumper = new Dumper();
33 36
 
34 37
             return $dumper->dump($value, $output);
Please login to merge, or discard this patch.
src/Dumper/src/Renderer/HtmlRenderer.php 1 patch
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * Default coloring schema.
23 23
      */
24
-    public const DEFAULT = [
24
+    public const default = [
25 25
         'body'     => '<pre style="background-color: white; font-family: monospace;">%s</pre>',
26 26
         'element'  => '<span style="%s;">%s</span>',
27 27
         'indent'   => '&middot;    ',
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * Set of styles associated with different dumping properties.
101 101
      */
102
-    protected array $style = self::DEFAULT;
102
+    protected array $style = self::default;
103 103
 
104
-    public function __construct(array $style = self::DEFAULT)
104
+    public function __construct(array $style = self::default)
105 105
     {
106 106
         $this->style = $style;
107 107
     }
Please login to merge, or discard this patch.
src/Stempler/src/Builder.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function compileTemplate(Template $tpl): Result
101 101
     {
102
-        try {
103
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
102
+        try{
103
+            if (isset($this->visitors[self::STAGE_COMPILE])){
104 104
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
105 105
                 $tpl = $traverser->traverse([$tpl])[0];
106 106
             }
107 107
 
108 108
             return $this->compiler->compile($tpl);
109
-        } catch (CompilerException $e) {
109
+        }catch (CompilerException $e){
110 110
             throw $this->mapException($e);
111 111
         }
112 112
     }
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
         $source = $this->loader->load($path);
121 121
         $stream = new StringStream($source->getContent());
122 122
 
123
-        try {
123
+        try{
124 124
             $tpl = $this->parser->withPath($path)->parse($stream);
125 125
             $tpl->setContext(new Context(
126 126
                 new Token(Token::TYPE_RAW, 0, ''),
127 127
                 $path
128 128
             ));
129
-        } catch (ParserException $e) {
129
+        }catch (ParserException $e){
130 130
             throw $this->mapException($e);
131 131
         }
132 132
 
133
-        try {
133
+        try{
134 134
             return $this->process($tpl);
135
-        } catch (ContextExceptionInterface $e) {
135
+        }catch (ContextExceptionInterface $e){
136 136
             throw $this->mapException($e);
137
-        } catch (Throwable $e) {
137
+        }catch (Throwable $e){
138 138
             throw $e;
139 139
         }
140 140
     }
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
      */
146 146
     private function process(Template $template): Template
147 147
     {
148
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
148
+        if (isset($this->visitors[self::STAGE_PREPARE])){
149 149
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
150 150
             $template = $traverser->traverse([$template])[0];
151 151
         }
152 152
 
153
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
153
+        if (isset($this->visitors[self::STAGE_TRANSFORM])){
154 154
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
155 155
             $template = $traverser->traverse([$template])[0];
156 156
         }
157 157
 
158
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
158
+        if (isset($this->visitors[self::STAGE_FINALIZE])){
159 159
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
160 160
             $template = $traverser->traverse([$template])[0];
161 161
         }
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
      */
169 169
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
170 170
     {
171
-        if ($e->getContext()->getPath() === null) {
171
+        if ($e->getContext()->getPath() === null){
172 172
             return $e;
173 173
         }
174 174
 
175
-        try {
175
+        try{
176 176
             $source = $this->loader->load($e->getContext()->getPath());
177
-        } catch (LoaderException $te) {
177
+        }catch (LoaderException $te){
178 178
             return $e;
179 179
         }
180 180
 
181
-        if ($source->getFilename() === null) {
181
+        if ($source->getFilename() === null){
182 182
             return $e;
183 183
         }
184 184
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -15 removed lines patch added patch discarded remove patch
@@ -99,14 +99,18 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function compileTemplate(Template $tpl): Result
101 101
     {
102
-        try {
103
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
102
+        try
103
+        {
104
+            if (isset($this->visitors[self::STAGE_COMPILE]))
105
+            {
104 106
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
105 107
                 $tpl = $traverser->traverse([$tpl])[0];
106 108
             }
107 109
 
108 110
             return $this->compiler->compile($tpl);
109
-        } catch (CompilerException $e) {
111
+        }
112
+        catch (CompilerException $e)
113
+        {
110 114
             throw $this->mapException($e);
111 115
         }
112 116
     }
@@ -120,21 +124,29 @@  discard block
 block discarded – undo
120 124
         $source = $this->loader->load($path);
121 125
         $stream = new StringStream($source->getContent());
122 126
 
123
-        try {
127
+        try
128
+        {
124 129
             $tpl = $this->parser->withPath($path)->parse($stream);
125 130
             $tpl->setContext(new Context(
126 131
                 new Token(Token::TYPE_RAW, 0, ''),
127 132
                 $path
128 133
             ));
129
-        } catch (ParserException $e) {
134
+        }
135
+        catch (ParserException $e)
136
+        {
130 137
             throw $this->mapException($e);
131 138
         }
132 139
 
133
-        try {
140
+        try
141
+        {
134 142
             return $this->process($tpl);
135
-        } catch (ContextExceptionInterface $e) {
143
+        }
144
+        catch (ContextExceptionInterface $e)
145
+        {
136 146
             throw $this->mapException($e);
137
-        } catch (Throwable $e) {
147
+        }
148
+        catch (Throwable $e)
149
+        {
138 150
             throw $e;
139 151
         }
140 152
     }
@@ -145,17 +157,20 @@  discard block
 block discarded – undo
145 157
      */
146 158
     private function process(Template $template): Template
147 159
     {
148
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
160
+        if (isset($this->visitors[self::STAGE_PREPARE]))
161
+        {
149 162
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
150 163
             $template = $traverser->traverse([$template])[0];
151 164
         }
152 165
 
153
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
166
+        if (isset($this->visitors[self::STAGE_TRANSFORM]))
167
+        {
154 168
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
155 169
             $template = $traverser->traverse([$template])[0];
156 170
         }
157 171
 
158
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
172
+        if (isset($this->visitors[self::STAGE_FINALIZE]))
173
+        {
159 174
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
160 175
             $template = $traverser->traverse([$template])[0];
161 176
         }
@@ -168,17 +183,22 @@  discard block
 block discarded – undo
168 183
      */
169 184
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
170 185
     {
171
-        if ($e->getContext()->getPath() === null) {
186
+        if ($e->getContext()->getPath() === null)
187
+        {
172 188
             return $e;
173 189
         }
174 190
 
175
-        try {
191
+        try
192
+        {
176 193
             $source = $this->loader->load($e->getContext()->getPath());
177
-        } catch (LoaderException $te) {
194
+        }
195
+        catch (LoaderException $te)
196
+        {
178 197
             return $e;
179 198
         }
180 199
 
181
-        if ($source->getFilename() === null) {
200
+        if ($source->getFilename() === null)
201
+        {
182 202
             return $e;
183 203
         }
184 204
 
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/HTMLSyntax.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function handle(Parser $parser, Assembler $asm, Token $token): void
70 70
     {
71
-        switch ($token->type) {
71
+        switch ($token->type){
72 72
             case HTMLGrammar::TYPE_OPEN:
73 73
             case HTMLGrammar::TYPE_OPEN_SHORT:
74 74
                 $this->node = new Tag(new Context($token, $parser->getPath()));
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
                 break;
78 78
 
79 79
             case HTMLGrammar::TYPE_KEYWORD:
80
-                if ($this->node->name === null) {
80
+                if ($this->node->name === null){
81 81
                     $this->node->name = $this->parseToken($parser, $token);
82 82
                     return;
83 83
                 }
84 84
 
85
-                if ($this->attr !== null && !$this->attr->value instanceof Nil) {
85
+                if ($this->attr !== null && !$this->attr->value instanceof Nil){
86 86
                     $this->attr->value = $this->parseToken($parser, $token);
87 87
                     $this->attr = null;
88 88
                     break;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 break;
99 99
 
100 100
             case HTMLGrammar::TYPE_EQUAL:
101
-                if ($this->attr === null) {
101
+                if ($this->attr === null){
102 102
                     throw new SyntaxException('unexpected attribute token', $token);
103 103
                 }
104 104
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 break;
108 108
 
109 109
             case HTMLGrammar::TYPE_ATTRIBUTE:
110
-                if ($this->attr === null) {
110
+                if ($this->attr === null){
111 111
                     throw new SyntaxException('unexpected attribute token', $token);
112 112
                 }
113 113
 
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
                         strpos($this->attr->name, 'on') === 0
118 118
                         || in_array($this->attr->name, self::VERBATIM_ATTRIBUTES, true)
119 119
                     )
120
-                ) {
120
+                ){
121 121
                     $this->attr->value = $this->parseVerbatim($parser, $token);
122
-                } else {
122
+                }else{
123 123
                     $this->attr->value = $this->parseToken($parser, $token);
124 124
                 }
125 125
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
                 break;
134 134
 
135 135
             case HTMLGrammar::TYPE_CLOSE:
136
-                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT) {
137
-                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name) {
136
+                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT){
137
+                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name){
138 138
                         throw new SyntaxException(
139 139
                             "Invalid closing tag `{$this->node->name}`, expected `{$asm->getNode()->name}`",
140 140
                             $this->token
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
                     }
143 143
 
144 144
                     $asm->close();
145
-                } else {
146
-                    if (in_array($this->node->name, self::VOID_TAGS)) {
145
+                }else{
146
+                    if (in_array($this->node->name, self::VOID_TAGS)){
147 147
                         $this->node->void = true;
148 148
                         $asm->push($this->node);
149
-                    } else {
149
+                    }else{
150 150
                         $asm->open($this->node, 'nodes');
151 151
                     }
152 152
                 }
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
                 break;
160 160
 
161 161
             default:
162
-                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim) {
162
+                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim){
163 163
                     $node = $this->parseToken($parser, $token);
164
-                    if (is_string($node)) {
164
+                    if (is_string($node)){
165 165
                         $node = new Raw($node, new Context($token, $parser->getPath()));
166 166
                     }
167 167
 
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $verbatim = new Verbatim(new Context($token, $parser->getPath()));
186 186
 
187
-        if ($token->tokens === []) {
188
-            if ($token->content) {
187
+        if ($token->tokens === []){
188
+            if ($token->content){
189 189
                 $verbatim->nodes[] = $token->content;
190 190
             }
191
-        } else {
191
+        }else{
192 192
             $parser->parseTokens(
193 193
                 new Assembler($verbatim, 'nodes'),
194 194
                 $token->tokens
Please login to merge, or discard this patch.
Braces   +36 added lines, -16 removed lines patch added patch discarded remove patch
@@ -68,7 +68,8 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function handle(Parser $parser, Assembler $asm, Token $token): void
70 70
     {
71
-        switch ($token->type) {
71
+        switch ($token->type)
72
+        {
72 73
             case HTMLGrammar::TYPE_OPEN:
73 74
             case HTMLGrammar::TYPE_OPEN_SHORT:
74 75
                 $this->node = new Tag(new Context($token, $parser->getPath()));
@@ -77,12 +78,14 @@  discard block
 block discarded – undo
77 78
                 break;
78 79
 
79 80
             case HTMLGrammar::TYPE_KEYWORD:
80
-                if ($this->node->name === null) {
81
+                if ($this->node->name === null)
82
+                {
81 83
                     $this->node->name = $this->parseToken($parser, $token);
82 84
                     return;
83 85
                 }
84 86
 
85
-                if ($this->attr !== null && !$this->attr->value instanceof Nil) {
87
+                if ($this->attr !== null && !$this->attr->value instanceof Nil)
88
+                {
86 89
                     $this->attr->value = $this->parseToken($parser, $token);
87 90
                     $this->attr = null;
88 91
                     break;
@@ -98,7 +101,8 @@  discard block
 block discarded – undo
98 101
                 break;
99 102
 
100 103
             case HTMLGrammar::TYPE_EQUAL:
101
-                if ($this->attr === null) {
104
+                if ($this->attr === null)
105
+                {
102 106
                     throw new SyntaxException('unexpected attribute token', $token);
103 107
                 }
104 108
 
@@ -107,7 +111,8 @@  discard block
 block discarded – undo
107 111
                 break;
108 112
 
109 113
             case HTMLGrammar::TYPE_ATTRIBUTE:
110
-                if ($this->attr === null) {
114
+                if ($this->attr === null)
115
+                {
111 116
                     throw new SyntaxException('unexpected attribute token', $token);
112 117
                 }
113 118
 
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
                     )
120 125
                 ) {
121 126
                     $this->attr->value = $this->parseVerbatim($parser, $token);
122
-                } else {
127
+                }
128
+                else
129
+                {
123 130
                     $this->attr->value = $this->parseToken($parser, $token);
124 131
                 }
125 132
 
@@ -133,8 +140,10 @@  discard block
 block discarded – undo
133 140
                 break;
134 141
 
135 142
             case HTMLGrammar::TYPE_CLOSE:
136
-                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT) {
137
-                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name) {
143
+                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT)
144
+                {
145
+                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name)
146
+                    {
138 147
                         throw new SyntaxException(
139 148
                             "Invalid closing tag `{$this->node->name}`, expected `{$asm->getNode()->name}`",
140 149
                             $this->token
@@ -142,11 +151,16 @@  discard block
 block discarded – undo
142 151
                     }
143 152
 
144 153
                     $asm->close();
145
-                } else {
146
-                    if (in_array($this->node->name, self::VOID_TAGS)) {
154
+                }
155
+                else
156
+                {
157
+                    if (in_array($this->node->name, self::VOID_TAGS))
158
+                    {
147 159
                         $this->node->void = true;
148 160
                         $asm->push($this->node);
149
-                    } else {
161
+                    }
162
+                    else
163
+                    {
150 164
                         $asm->open($this->node, 'nodes');
151 165
                     }
152 166
                 }
@@ -159,9 +173,11 @@  discard block
 block discarded – undo
159 173
                 break;
160 174
 
161 175
             default:
162
-                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim) {
176
+                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim)
177
+                {
163 178
                     $node = $this->parseToken($parser, $token);
164
-                    if (is_string($node)) {
179
+                    if (is_string($node))
180
+                    {
165 181
                         $node = new Raw($node, new Context($token, $parser->getPath()));
166 182
                     }
167 183
 
@@ -184,11 +200,15 @@  discard block
 block discarded – undo
184 200
     {
185 201
         $verbatim = new Verbatim(new Context($token, $parser->getPath()));
186 202
 
187
-        if ($token->tokens === []) {
188
-            if ($token->content) {
203
+        if ($token->tokens === [])
204
+        {
205
+            if ($token->content)
206
+            {
189 207
                 $verbatim->nodes[] = $token->content;
190 208
             }
191
-        } else {
209
+        }
210
+        else
211
+        {
192 212
             $parser->parseTokens(
193 213
                 new Assembler($verbatim, 'nodes'),
194 214
                 $token->tokens
Please login to merge, or discard this patch.