Passed
Pull Request — master (#656)
by Abdul Malik
18:10 queued 08:15
created
src/Stempler/src/Lexer/Grammar/InlineGrammar.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function parse(Buffer $src): Generator
51 51
     {
52
-        while ($n = $src->next()) {
53
-            if (!$n instanceof Byte || $n->char !== '$' || $src->lookaheadByte() !== '{') {
52
+        while ($n = $src->next()){
53
+            if (!$n instanceof Byte || $n->char !== '$' || $src->lookaheadByte() !== '{'){
54 54
                 yield $n;
55 55
                 continue;
56 56
             }
57 57
 
58 58
             $binding = (clone $this)->parseGrammar($src, $n->offset);
59
-            if ($binding === null) {
59
+            if ($binding === null){
60 60
                 yield $n;
61 61
                 $src->replay($n->offset);
62 62
                 continue;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public static function tokenName(int $token): string
74 74
     {
75
-        switch ($token) {
75
+        switch ($token){
76 76
             case self::TYPE_OPEN_TAG:
77 77
                 return 'INLINE:OPEN_TAG';
78 78
             case self::TYPE_CLOSE_TAG:
@@ -94,27 +94,27 @@  discard block
 block discarded – undo
94 94
     private function parseGrammar(Buffer $src, int $offset): ?array
95 95
     {
96 96
         $this->tokens = [
97
-            new Token(self::TYPE_OPEN_TAG, $offset, '$' . $src->next()->char),
97
+            new Token(self::TYPE_OPEN_TAG, $offset, '$'.$src->next()->char),
98 98
         ];
99 99
 
100
-        while ($n = $src->next()) {
101
-            if (!$n instanceof Byte) {
100
+        while ($n = $src->next()){
101
+            if (!$n instanceof Byte){
102 102
                 // no other grammars are allowed
103 103
                 return null;
104 104
             }
105 105
 
106
-            switch ($n->char) {
106
+            switch ($n->char){
107 107
                 case '"':
108 108
                 case "'":
109
-                    if ($this->default === null) {
109
+                    if ($this->default === null){
110 110
                         // " and ' not allowed in names
111 111
                         return null;
112 112
                     }
113 113
 
114 114
                     $this->default[] = $n;
115
-                    while ($nn = $src->next()) {
115
+                    while ($nn = $src->next()){
116 116
                         $this->default[] = $nn;
117
-                        if ($nn instanceof Byte && $nn->char === $n->char) {
117
+                        if ($nn instanceof Byte && $nn->char === $n->char){
118 118
                             break;
119 119
                         }
120 120
                     }
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
                     break;
148 148
 
149 149
                 default:
150
-                    if ($this->default !== null) {
150
+                    if ($this->default !== null){
151 151
                         // default allows spaces
152 152
                         $this->default[] = $n;
153 153
                         break;
154 154
                     }
155 155
 
156
-                    if (preg_match(self::REGEXP_WHITESPACE, $n->char)) {
156
+                    if (preg_match(self::REGEXP_WHITESPACE, $n->char)){
157 157
                         break;
158 158
                     }
159 159
 
160
-                    if (preg_match(self::REGEXP_KEYWORD, $n->char)) {
160
+                    if (preg_match(self::REGEXP_KEYWORD, $n->char)){
161 161
                         $this->name[] = $n;
162 162
                         break;
163 163
                     }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             }
167 167
         }
168 168
 
169
-        if (!$this->isValid()) {
169
+        if (!$this->isValid()){
170 170
             return null;
171 171
         }
172 172
 
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 
176 176
     private function isValid(): bool
177 177
     {
178
-        if (count($this->tokens) < 3) {
178
+        if (count($this->tokens) < 3){
179 179
             return false;
180 180
         }
181 181
 
182 182
         $hasName = false;
183 183
         $hasDefault = null;
184
-        foreach ($this->tokens as $token) {
185
-            if ($token->type === self::TYPE_NAME) {
184
+        foreach ($this->tokens as $token){
185
+            if ($token->type === self::TYPE_NAME){
186 186
                 $hasName = true;
187 187
                 continue;
188 188
             }
189 189
 
190
-            if ($token->type === self::TYPE_SEPARATOR && $hasDefault === null) {
190
+            if ($token->type === self::TYPE_SEPARATOR && $hasDefault === null){
191 191
                 $hasDefault = false;
192 192
                 continue;
193 193
             }
194 194
 
195
-            if ($token->type === self::TYPE_DEFAULT) {
196
-                if ($hasDefault === true) {
195
+            if ($token->type === self::TYPE_DEFAULT){
196
+                if ($hasDefault === true){
197 197
                     // multiple default value
198 198
                     return false;
199 199
                 }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function flushName(): void
212 212
     {
213
-        if ($this->name === []) {
213
+        if ($this->name === []){
214 214
             return;
215 215
         }
216 216
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     private function flushDefault(): void
225 225
     {
226
-        if ($this->default === [] || $this->default === null) {
226
+        if ($this->default === [] || $this->default === null){
227 227
             return;
228 228
         }
229 229
 
Please login to merge, or discard this patch.
Braces   +44 added lines, -22 removed lines patch added patch discarded remove patch
@@ -49,14 +49,17 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function parse(Buffer $src): Generator
51 51
     {
52
-        while ($n = $src->next()) {
53
-            if (!$n instanceof Byte || $n->char !== '$' || $src->lookaheadByte() !== '{') {
52
+        while ($n = $src->next())
53
+        {
54
+            if (!$n instanceof Byte || $n->char !== '$' || $src->lookaheadByte() !== '{')
55
+            {
54 56
                 yield $n;
55 57
                 continue;
56 58
             }
57 59
 
58 60
             $binding = (clone $this)->parseGrammar($src, $n->offset);
59
-            if ($binding === null) {
61
+            if ($binding === null)
62
+            {
60 63
                 yield $n;
61 64
                 $src->replay($n->offset);
62 65
                 continue;
@@ -72,7 +75,8 @@  discard block
 block discarded – undo
72 75
      */
73 76
     public static function tokenName(int $token): string
74 77
     {
75
-        switch ($token) {
78
+        switch ($token)
79
+        {
76 80
             case self::TYPE_OPEN_TAG:
77 81
                 return 'INLINE:OPEN_TAG';
78 82
             case self::TYPE_CLOSE_TAG:
@@ -97,24 +101,30 @@  discard block
 block discarded – undo
97 101
             new Token(self::TYPE_OPEN_TAG, $offset, '$' . $src->next()->char),
98 102
         ];
99 103
 
100
-        while ($n = $src->next()) {
101
-            if (!$n instanceof Byte) {
104
+        while ($n = $src->next())
105
+        {
106
+            if (!$n instanceof Byte)
107
+            {
102 108
                 // no other grammars are allowed
103 109
                 return null;
104 110
             }
105 111
 
106
-            switch ($n->char) {
112
+            switch ($n->char)
113
+            {
107 114
                 case '"':
108 115
                 case "'":
109
-                    if ($this->default === null) {
116
+                    if ($this->default === null)
117
+                    {
110 118
                         // " and ' not allowed in names
111 119
                         return null;
112 120
                     }
113 121
 
114 122
                     $this->default[] = $n;
115
-                    while ($nn = $src->next()) {
123
+                    while ($nn = $src->next())
124
+                    {
116 125
                         $this->default[] = $nn;
117
-                        if ($nn instanceof Byte && $nn->char === $n->char) {
126
+                        if ($nn instanceof Byte && $nn->char === $n->char)
127
+                        {
118 128
                             break;
119 129
                         }
120 130
                     }
@@ -147,17 +157,20 @@  discard block
 block discarded – undo
147 157
                     break;
148 158
 
149 159
                 default:
150
-                    if ($this->default !== null) {
160
+                    if ($this->default !== null)
161
+                    {
151 162
                         // default allows spaces
152 163
                         $this->default[] = $n;
153 164
                         break;
154 165
                     }
155 166
 
156
-                    if (preg_match(self::REGEXP_WHITESPACE, $n->char)) {
167
+                    if (preg_match(self::REGEXP_WHITESPACE, $n->char))
168
+                    {
157 169
                         break;
158 170
                     }
159 171
 
160
-                    if (preg_match(self::REGEXP_KEYWORD, $n->char)) {
172
+                    if (preg_match(self::REGEXP_KEYWORD, $n->char))
173
+                    {
161 174
                         $this->name[] = $n;
162 175
                         break;
163 176
                     }
@@ -166,7 +179,8 @@  discard block
 block discarded – undo
166 179
             }
167 180
         }
168 181
 
169
-        if (!$this->isValid()) {
182
+        if (!$this->isValid())
183
+        {
170 184
             return null;
171 185
         }
172 186
 
@@ -175,25 +189,31 @@  discard block
 block discarded – undo
175 189
 
176 190
     private function isValid(): bool
177 191
     {
178
-        if (count($this->tokens) < 3) {
192
+        if (count($this->tokens) < 3)
193
+        {
179 194
             return false;
180 195
         }
181 196
 
182 197
         $hasName = false;
183 198
         $hasDefault = null;
184
-        foreach ($this->tokens as $token) {
185
-            if ($token->type === self::TYPE_NAME) {
199
+        foreach ($this->tokens as $token)
200
+        {
201
+            if ($token->type === self::TYPE_NAME)
202
+            {
186 203
                 $hasName = true;
187 204
                 continue;
188 205
             }
189 206
 
190
-            if ($token->type === self::TYPE_SEPARATOR && $hasDefault === null) {
207
+            if ($token->type === self::TYPE_SEPARATOR && $hasDefault === null)
208
+            {
191 209
                 $hasDefault = false;
192 210
                 continue;
193 211
             }
194 212
 
195
-            if ($token->type === self::TYPE_DEFAULT) {
196
-                if ($hasDefault === true) {
213
+            if ($token->type === self::TYPE_DEFAULT)
214
+            {
215
+                if ($hasDefault === true)
216
+                {
197 217
                     // multiple default value
198 218
                     return false;
199 219
                 }
@@ -210,7 +230,8 @@  discard block
 block discarded – undo
210 230
      */
211 231
     private function flushName(): void
212 232
     {
213
-        if ($this->name === []) {
233
+        if ($this->name === [])
234
+        {
214 235
             return;
215 236
         }
216 237
 
@@ -223,7 +244,8 @@  discard block
 block discarded – undo
223 244
      */
224 245
     private function flushDefault(): void
225 246
     {
226
-        if ($this->default === [] || $this->default === null) {
247
+        if ($this->default === [] || $this->default === null)
248
+        {
227 249
             return;
228 250
         }
229 251
 
Please login to merge, or discard this patch.
src/Hmvc/src/AbstractCore.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function callAction(string $controller, string $action, array $parameters = [])
46 46
     {
47
-        try {
47
+        try{
48 48
             $method = new ReflectionMethod($controller, $action);
49
-        } catch (ReflectionException $e) {
49
+        }catch (ReflectionException $e){
50 50
             throw new ControllerException(
51 51
                 "Invalid action `{$controller}`->`{$action}`",
52 52
                 ControllerException::BAD_ACTION,
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
             );
55 55
         }
56 56
 
57
-        if ($method->isStatic() || !$method->isPublic()) {
57
+        if ($method->isStatic() || !$method->isPublic()){
58 58
             throw new ControllerException(
59 59
                 "Invalid action `{$controller}`->`{$action}`",
60 60
                 ControllerException::BAD_ACTION
61 61
             );
62 62
         }
63 63
 
64
-        try {
64
+        try{
65 65
             // getting the set of arguments should be sent to requested method
66 66
             $args = $this->resolver->resolveArguments($method, $parameters);
67
-        } catch (ArgumentException $e) {
67
+        }catch (ArgumentException $e){
68 68
             throw new ControllerException(
69 69
                 "Missing/invalid parameter '{$e->getParameter()->name}' of  `{$controller}`->`{$action}`",
70 70
                 ControllerException::BAD_ARGUMENT
71 71
             );
72
-        } catch (ContainerExceptionInterface $e) {
72
+        }catch (ContainerExceptionInterface $e){
73 73
             throw new ControllerException(
74 74
                 $e->getMessage(),
75 75
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,9 +44,12 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function callAction(string $controller, string $action, array $parameters = [])
46 46
     {
47
-        try {
47
+        try
48
+        {
48 49
             $method = new ReflectionMethod($controller, $action);
49
-        } catch (ReflectionException $e) {
50
+        }
51
+        catch (ReflectionException $e)
52
+        {
50 53
             throw new ControllerException(
51 54
                 "Invalid action `{$controller}`->`{$action}`",
52 55
                 ControllerException::BAD_ACTION,
@@ -54,22 +57,28 @@  discard block
 block discarded – undo
54 57
             );
55 58
         }
56 59
 
57
-        if ($method->isStatic() || !$method->isPublic()) {
60
+        if ($method->isStatic() || !$method->isPublic())
61
+        {
58 62
             throw new ControllerException(
59 63
                 "Invalid action `{$controller}`->`{$action}`",
60 64
                 ControllerException::BAD_ACTION
61 65
             );
62 66
         }
63 67
 
64
-        try {
68
+        try
69
+        {
65 70
             // getting the set of arguments should be sent to requested method
66 71
             $args = $this->resolver->resolveArguments($method, $parameters);
67
-        } catch (ArgumentException $e) {
72
+        }
73
+        catch (ArgumentException $e)
74
+        {
68 75
             throw new ControllerException(
69 76
                 "Missing/invalid parameter '{$e->getParameter()->name}' of  `{$controller}`->`{$action}`",
70 77
                 ControllerException::BAD_ARGUMENT
71 78
             );
72
-        } catch (ContainerExceptionInterface $e) {
79
+        }
80
+        catch (ContainerExceptionInterface $e)
81
+        {
73 82
             throw new ControllerException(
74 83
                 $e->getMessage(),
75 84
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
src/Exceptions/src/ConsoleHandler.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $result = '';
70 70
 
71
-        if ($e instanceof Error) {
72
-            $result .= $this->renderHeader('[' . get_class($e) . "]\n" . $e->getMessage(), 'bg:magenta,white');
73
-        } else {
74
-            $result .= $this->renderHeader('[' . get_class($e) . "]\n" . $e->getMessage(), 'bg:red,white');
71
+        if ($e instanceof Error){
72
+            $result .= $this->renderHeader('['.get_class($e)."]\n".$e->getMessage(), 'bg:magenta,white');
73
+        }else{
74
+            $result .= $this->renderHeader('['.get_class($e)."]\n".$e->getMessage(), 'bg:red,white');
75 75
         }
76 76
 
77 77
         $result .= $this->format(
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
             $e->getLine()
81 81
         );
82 82
 
83
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
83
+        if ($verbosity >= self::VERBOSITY_DEBUG){
84 84
             $result .= $this->renderTrace($e, new Highlighter(
85 85
                 $this->colorsSupport ? new ConsoleStyle() : new PlainStyle()
86 86
             ));
87
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
87
+        } elseif ($verbosity >= self::VERBOSITY_VERBOSE){
88 88
             $result .= $this->renderTrace($e);
89 89
         }
90 90
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         $length += $padding;
112 112
 
113
-        foreach ($lines as $line) {
113
+        foreach ($lines as $line){
114 114
             $result .= $this->format(
115 115
                 "<{$style}>%s%s%s</reset>\n",
116 116
                 str_repeat(' ', $padding + 1),
@@ -130,34 +130,34 @@  discard block
 block discarded – undo
130 130
     private function renderTrace(Throwable $e, Highlighter $h = null): string
131 131
     {
132 132
         $stacktrace = $this->getStacktrace($e);
133
-        if (empty($stacktrace)) {
133
+        if (empty($stacktrace)){
134 134
             return '';
135 135
         }
136 136
 
137 137
         $result = $this->format("\n<red>Exception Trace:</reset>\n");
138 138
 
139
-        foreach ($stacktrace as $trace) {
140
-            if (isset($trace['type']) && isset($trace['class'])) {
139
+        foreach ($stacktrace as $trace){
140
+            if (isset($trace['type']) && isset($trace['class'])){
141 141
                 $line = $this->format(
142 142
                     ' <white>%s%s%s()</reset>',
143 143
                     $trace['class'],
144 144
                     $trace['type'],
145 145
                     $trace['function']
146 146
                 );
147
-            } else {
147
+            }else{
148 148
                 $line = $this->format(
149 149
                     ' <white>%s()</reset>',
150 150
                     $trace['function']
151 151
                 );
152 152
             }
153 153
 
154
-            if (isset($trace['file'])) {
154
+            if (isset($trace['file'])){
155 155
                 $line .= $this->format(
156 156
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
157 157
                     $trace['file'],
158 158
                     $trace['line']
159 159
                 );
160
-            } else {
160
+            }else{
161 161
                 $line .= $this->format(
162 162
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
163 163
                     'n/a',
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
                 );
166 166
             }
167 167
 
168
-            $result .= $line . "\n";
168
+            $result .= $line."\n";
169 169
 
170
-            if (!empty($h) && !empty($trace['file'])) {
170
+            if (!empty($h) && !empty($trace['file'])){
171 171
                 $result .= $h->highlightLines(
172 172
                     file_get_contents($trace['file']),
173 173
                     $trace['line'],
174 174
                     static::SHOW_LINES
175
-                ) . "\n";
175
+                )."\n";
176 176
             }
177 177
         }
178 178
 
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
      */
187 187
     private function format(string $format, ...$args): string
188 188
     {
189
-        if (!$this->colorsSupport) {
189
+        if (!$this->colorsSupport){
190 190
             $format = preg_replace('/<[^>]+>/', '', $format);
191
-        } else {
192
-            $format = preg_replace_callback('/(<([^>]+)>)/', function ($partial) {
191
+        }else{
192
+            $format = preg_replace_callback('/(<([^>]+)>)/', function ($partial){
193 193
                 $style = '';
194
-                foreach (explode(',', trim($partial[2], '/')) as $color) {
195
-                    if (isset(self::COLORS[$color])) {
194
+                foreach (explode(',', trim($partial[2], '/')) as $color){
195
+                    if (isset(self::COLORS[$color])){
196 196
                         $style .= self::COLORS[$color];
197 197
                     }
198 198
                 }
Please login to merge, or discard this patch.
Braces   +39 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,9 +68,12 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $result = '';
70 70
 
71
-        if ($e instanceof Error) {
71
+        if ($e instanceof Error)
72
+        {
72 73
             $result .= $this->renderHeader('[' . get_class($e) . "]\n" . $e->getMessage(), 'bg:magenta,white');
73
-        } else {
74
+        }
75
+        else
76
+        {
74 77
             $result .= $this->renderHeader('[' . get_class($e) . "]\n" . $e->getMessage(), 'bg:red,white');
75 78
         }
76 79
 
@@ -80,11 +83,14 @@  discard block
 block discarded – undo
80 83
             $e->getLine()
81 84
         );
82 85
 
83
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
86
+        if ($verbosity >= self::VERBOSITY_DEBUG)
87
+        {
84 88
             $result .= $this->renderTrace($e, new Highlighter(
85 89
                 $this->colorsSupport ? new ConsoleStyle() : new PlainStyle()
86 90
             ));
87
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
91
+        }
92
+        elseif ($verbosity >= self::VERBOSITY_VERBOSE)
93
+        {
88 94
             $result .= $this->renderTrace($e);
89 95
         }
90 96
 
@@ -110,7 +116,8 @@  discard block
 block discarded – undo
110 116
 
111 117
         $length += $padding;
112 118
 
113
-        foreach ($lines as $line) {
119
+        foreach ($lines as $line)
120
+        {
114 121
             $result .= $this->format(
115 122
                 "<{$style}>%s%s%s</reset>\n",
116 123
                 str_repeat(' ', $padding + 1),
@@ -130,34 +137,42 @@  discard block
 block discarded – undo
130 137
     private function renderTrace(Throwable $e, Highlighter $h = null): string
131 138
     {
132 139
         $stacktrace = $this->getStacktrace($e);
133
-        if (empty($stacktrace)) {
140
+        if (empty($stacktrace))
141
+        {
134 142
             return '';
135 143
         }
136 144
 
137 145
         $result = $this->format("\n<red>Exception Trace:</reset>\n");
138 146
 
139
-        foreach ($stacktrace as $trace) {
140
-            if (isset($trace['type']) && isset($trace['class'])) {
147
+        foreach ($stacktrace as $trace)
148
+        {
149
+            if (isset($trace['type']) && isset($trace['class']))
150
+            {
141 151
                 $line = $this->format(
142 152
                     ' <white>%s%s%s()</reset>',
143 153
                     $trace['class'],
144 154
                     $trace['type'],
145 155
                     $trace['function']
146 156
                 );
147
-            } else {
157
+            }
158
+            else
159
+            {
148 160
                 $line = $this->format(
149 161
                     ' <white>%s()</reset>',
150 162
                     $trace['function']
151 163
                 );
152 164
             }
153 165
 
154
-            if (isset($trace['file'])) {
166
+            if (isset($trace['file']))
167
+            {
155 168
                 $line .= $this->format(
156 169
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
157 170
                     $trace['file'],
158 171
                     $trace['line']
159 172
                 );
160
-            } else {
173
+            }
174
+            else
175
+            {
161 176
                 $line .= $this->format(
162 177
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
163 178
                     'n/a',
@@ -167,7 +182,8 @@  discard block
 block discarded – undo
167 182
 
168 183
             $result .= $line . "\n";
169 184
 
170
-            if (!empty($h) && !empty($trace['file'])) {
185
+            if (!empty($h) && !empty($trace['file']))
186
+            {
171 187
                 $result .= $h->highlightLines(
172 188
                     file_get_contents($trace['file']),
173 189
                     $trace['line'],
@@ -186,13 +202,19 @@  discard block
 block discarded – undo
186 202
      */
187 203
     private function format(string $format, ...$args): string
188 204
     {
189
-        if (!$this->colorsSupport) {
205
+        if (!$this->colorsSupport)
206
+        {
190 207
             $format = preg_replace('/<[^>]+>/', '', $format);
191
-        } else {
192
-            $format = preg_replace_callback('/(<([^>]+)>)/', function ($partial) {
208
+        }
209
+        else
210
+        {
211
+            $format = preg_replace_callback('/(<([^>]+)>)/', function ($partial)
212
+            {
193 213
                 $style = '';
194
-                foreach (explode(',', trim($partial[2], '/')) as $color) {
195
-                    if (isset(self::COLORS[$color])) {
214
+                foreach (explode(',', trim($partial[2], '/')) as $color)
215
+                {
216
+                    if (isset(self::COLORS[$color]))
217
+                    {
196 218
                         $style .= self::COLORS[$color];
197 219
                     }
198 220
                 }
Please login to merge, or discard this patch.
src/Exceptions/src/PlainHandler.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $result = '';
28 28
 
29
-        $result .= '[' . get_class($e) . "]\n" . $e->getMessage();
29
+        $result .= '['.get_class($e)."]\n".$e->getMessage();
30 30
 
31 31
         $result .= sprintf(" in %s:%s\n", $e->getFile(), $e->getLine());
32 32
 
33
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
33
+        if ($verbosity >= self::VERBOSITY_DEBUG){
34 34
             $result .= $this->renderTrace($e, new Highlighter(new PlainStyle()));
35
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
35
+        } elseif ($verbosity >= self::VERBOSITY_VERBOSE){
36 36
             $result .= $this->renderTrace($e);
37 37
         }
38 38
 
@@ -47,38 +47,38 @@  discard block
 block discarded – undo
47 47
     private function renderTrace(Throwable $e, Highlighter $h = null): string
48 48
     {
49 49
         $stacktrace = $this->getStacktrace($e);
50
-        if (empty($stacktrace)) {
50
+        if (empty($stacktrace)){
51 51
             return '';
52 52
         }
53 53
 
54 54
         $result = "\nException Trace:\n";
55 55
 
56
-        foreach ($stacktrace as $trace) {
57
-            if (isset($trace['type']) && isset($trace['class'])) {
56
+        foreach ($stacktrace as $trace){
57
+            if (isset($trace['type']) && isset($trace['class'])){
58 58
                 $line = sprintf(
59 59
                     ' %s%s%s()',
60 60
                     $trace['class'],
61 61
                     $trace['type'],
62 62
                     $trace['function']
63 63
                 );
64
-            } else {
64
+            }else{
65 65
                 $line = $trace['function'];
66 66
             }
67 67
 
68
-            if (isset($trace['file'])) {
68
+            if (isset($trace['file'])){
69 69
                 $line .= sprintf(' at %s:%s', $trace['file'], $trace['line']);
70
-            } else {
70
+            }else{
71 71
                 $line .= sprintf(' at %s:%s', 'n/a', 'n/a');
72 72
             }
73 73
 
74
-            $result .= $line . "\n";
74
+            $result .= $line."\n";
75 75
 
76
-            if (!empty($h) && !empty($trace['file'])) {
76
+            if (!empty($h) && !empty($trace['file'])){
77 77
                 $result .= $h->highlightLines(
78 78
                     file_get_contents($trace['file']),
79 79
                     $trace['line'],
80 80
                     static::SHOW_LINES
81
-                ) . "\n";
81
+                )."\n";
82 82
             }
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,9 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
         $result .= sprintf(" in %s:%s\n", $e->getFile(), $e->getLine());
32 32
 
33
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
33
+        if ($verbosity >= self::VERBOSITY_DEBUG)
34
+        {
34 35
             $result .= $this->renderTrace($e, new Highlighter(new PlainStyle()));
35
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
36
+        }
37
+        elseif ($verbosity >= self::VERBOSITY_VERBOSE)
38
+        {
36 39
             $result .= $this->renderTrace($e);
37 40
         }
38 41
 
@@ -47,33 +50,42 @@  discard block
 block discarded – undo
47 50
     private function renderTrace(Throwable $e, Highlighter $h = null): string
48 51
     {
49 52
         $stacktrace = $this->getStacktrace($e);
50
-        if (empty($stacktrace)) {
53
+        if (empty($stacktrace))
54
+        {
51 55
             return '';
52 56
         }
53 57
 
54 58
         $result = "\nException Trace:\n";
55 59
 
56
-        foreach ($stacktrace as $trace) {
57
-            if (isset($trace['type']) && isset($trace['class'])) {
60
+        foreach ($stacktrace as $trace)
61
+        {
62
+            if (isset($trace['type']) && isset($trace['class']))
63
+            {
58 64
                 $line = sprintf(
59 65
                     ' %s%s%s()',
60 66
                     $trace['class'],
61 67
                     $trace['type'],
62 68
                     $trace['function']
63 69
                 );
64
-            } else {
70
+            }
71
+            else
72
+            {
65 73
                 $line = $trace['function'];
66 74
             }
67 75
 
68
-            if (isset($trace['file'])) {
76
+            if (isset($trace['file']))
77
+            {
69 78
                 $line .= sprintf(' at %s:%s', $trace['file'], $trace['line']);
70
-            } else {
79
+            }
80
+            else
81
+            {
71 82
                 $line .= sprintf(' at %s:%s', 'n/a', 'n/a');
72 83
             }
73 84
 
74 85
             $result .= $line . "\n";
75 86
 
76
-            if (!empty($h) && !empty($trace['file'])) {
87
+            if (!empty($h) && !empty($trace['file']))
88
+            {
77 89
                 $result .= $h->highlightLines(
78 90
                     file_get_contents($trace['file']),
79 91
                     $trace['line'],
Please login to merge, or discard this patch.
src/Exceptions/src/AbstractHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     protected function getStacktrace(Throwable $e): array
33 33
     {
34 34
         $stacktrace = $e->getTrace();
35
-        if (empty($stacktrace)) {
35
+        if (empty($stacktrace)){
36 36
             return [];
37 37
         }
38 38
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 'line' => $e->getLine(),
43 43
             ] + $stacktrace[0];
44 44
 
45
-        if ($stacktrace[0] != $header) {
45
+        if ($stacktrace[0] != $header){
46 46
             array_unshift($stacktrace, $header);
47 47
         }
48 48
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
     protected function getStacktrace(Throwable $e): array
33 33
     {
34 34
         $stacktrace = $e->getTrace();
35
-        if (empty($stacktrace)) {
35
+        if (empty($stacktrace))
36
+        {
36 37
             return [];
37 38
         }
38 39
 
@@ -42,7 +43,8 @@  discard block
 block discarded – undo
42 43
                 'line' => $e->getLine(),
43 44
             ] + $stacktrace[0];
44 45
 
45
-        if ($stacktrace[0] != $header) {
46
+        if ($stacktrace[0] != $header)
47
+        {
46 48
             array_unshift($stacktrace, $header);
47 49
         }
48 50
 
Please login to merge, or discard this patch.
src/Exceptions/src/ValueWrapper.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,33 +43,33 @@
 block discarded – undo
43 43
     public function wrap(array $args): array
44 44
     {
45 45
         $result = [];
46
-        foreach ($args as $arg) {
46
+        foreach ($args as $arg){
47 47
             $display = $type = strtolower(gettype($arg));
48 48
 
49
-            if (is_numeric($arg)) {
49
+            if (is_numeric($arg)){
50 50
                 $result[] = $this->r->apply($arg, 'value', $type);
51 51
                 continue;
52
-            } elseif (is_bool($arg)) {
52
+            } elseif (is_bool($arg)){
53 53
                 $result[] = $this->r->apply($arg ? 'true' : 'false', 'value', $type);
54 54
                 continue;
55
-            } elseif (is_null($arg)) {
55
+            } elseif (is_null($arg)){
56 56
                 $result[] = $this->r->apply('null', 'value', $type);
57 57
                 continue;
58 58
             }
59 59
 
60
-            if (is_object($arg)) {
60
+            if (is_object($arg)){
61 61
                 $reflection = new ReflectionClass($arg);
62 62
                 $display = sprintf('<span title="%s">%s</span>', $reflection->getName(), $reflection->getShortName());
63 63
             }
64 64
 
65 65
             $type = $this->r->apply($display, 'value', $type);
66 66
 
67
-            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG) {
67
+            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG){
68 68
                 $result[] = sprintf('<span>%s</span>', $type);
69
-            } else {
69
+            }else{
70 70
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg, JSON_THROW_ON_ERROR));
71 71
 
72
-                if (!isset($this->values[$hash])) {
72
+                if (!isset($this->values[$hash])){
73 73
                     $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
74 74
                 }
75 75
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,33 +43,44 @@
 block discarded – undo
43 43
     public function wrap(array $args): array
44 44
     {
45 45
         $result = [];
46
-        foreach ($args as $arg) {
46
+        foreach ($args as $arg)
47
+        {
47 48
             $display = $type = strtolower(gettype($arg));
48 49
 
49
-            if (is_numeric($arg)) {
50
+            if (is_numeric($arg))
51
+            {
50 52
                 $result[] = $this->r->apply($arg, 'value', $type);
51 53
                 continue;
52
-            } elseif (is_bool($arg)) {
54
+            }
55
+            elseif (is_bool($arg))
56
+            {
53 57
                 $result[] = $this->r->apply($arg ? 'true' : 'false', 'value', $type);
54 58
                 continue;
55
-            } elseif (is_null($arg)) {
59
+            }
60
+            elseif (is_null($arg))
61
+            {
56 62
                 $result[] = $this->r->apply('null', 'value', $type);
57 63
                 continue;
58 64
             }
59 65
 
60
-            if (is_object($arg)) {
66
+            if (is_object($arg))
67
+            {
61 68
                 $reflection = new ReflectionClass($arg);
62 69
                 $display = sprintf('<span title="%s">%s</span>', $reflection->getName(), $reflection->getShortName());
63 70
             }
64 71
 
65 72
             $type = $this->r->apply($display, 'value', $type);
66 73
 
67
-            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG) {
74
+            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG)
75
+            {
68 76
                 $result[] = sprintf('<span>%s</span>', $type);
69
-            } else {
77
+            }
78
+            else
79
+            {
70 80
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg, JSON_THROW_ON_ERROR));
71 81
 
72
-                if (!isset($this->values[$hash])) {
82
+                if (!isset($this->values[$hash]))
83
+                {
73 84
                     $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
74 85
                 }
75 86
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg, JSON_THROW_ON_ERROR));
71 71
 
72 72
                 if (!isset($this->values[$hash])) {
73
-                    $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
73
+                    $this->values[$hash] = $this->dumper->dump($arg, Dumper::return);
74 74
                 }
75 75
 
76 76
                 $result[] = sprintf('<span onclick="_da(\'%s\')">%s</span>', $hash, $type);
Please login to merge, or discard this patch.
src/Exceptions/src/JsonHandler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@
 block discarded – undo
32 32
 
33 33
     private function renderTrace(array $trace, int $verbosity): Generator
34 34
     {
35
-        foreach ($trace as $item) {
35
+        foreach ($trace as $item){
36 36
             $result = [];
37 37
 
38
-            if (isset($item['class'])) {
38
+            if (isset($item['class'])){
39 39
                 $result['function'] = sprintf(
40 40
                     '%s%s%s()',
41 41
                     $item['class'],
42 42
                     $item['type'],
43 43
                     $item['function']
44 44
                 );
45
-            } else {
45
+            }else{
46 46
                 $result['function'] = sprintf(
47 47
                     '%s()',
48 48
                     $item['function']
49 49
                 );
50 50
             }
51 51
 
52
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
52
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])){
53 53
                 $result['at'] = [
54 54
                     'file' => $item['file'] ?? null,
55 55
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,24 +32,29 @@
 block discarded – undo
32 32
 
33 33
     private function renderTrace(array $trace, int $verbosity): Generator
34 34
     {
35
-        foreach ($trace as $item) {
35
+        foreach ($trace as $item)
36
+        {
36 37
             $result = [];
37 38
 
38
-            if (isset($item['class'])) {
39
+            if (isset($item['class']))
40
+            {
39 41
                 $result['function'] = sprintf(
40 42
                     '%s%s%s()',
41 43
                     $item['class'],
42 44
                     $item['type'],
43 45
                     $item['function']
44 46
                 );
45
-            } else {
47
+            }
48
+            else
49
+            {
46 50
                 $result['function'] = sprintf(
47 51
                     '%s()',
48 52
                     $item['function']
49 53
                 );
50 54
             }
51 55
 
52
-            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) {
56
+            if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file']))
57
+            {
53 58
                 $result['at'] = [
54 59
                     'file' => $item['file'] ?? null,
55 60
                     'line' => $item['line'] ?? null,
Please login to merge, or discard this patch.
src/AuthHttp/src/TransportRegistry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     {
41 41
         $name ??= $this->default;
42 42
 
43
-        if (!isset($this->transports[$name])) {
43
+        if (!isset($this->transports[$name])){
44 44
             throw new TransportException("Undefined auth transport {$name}");
45 45
         }
46 46
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,8 @@
 block discarded – undo
40 40
     {
41 41
         $name ??= $this->default;
42 42
 
43
-        if (!isset($this->transports[$name])) {
43
+        if (!isset($this->transports[$name]))
44
+        {
44 45
             throw new TransportException("Undefined auth transport {$name}");
45 46
         }
46 47
 
Please login to merge, or discard this patch.
src/AuthHttp/src/Transport/CookieTransport.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         bool $secure = false,
44 44
         bool $httpOnly = true,
45 45
         ?string $sameSite = null
46
-    ) {
46
+    ){
47 47
         $this->cookie = $cookie;
48 48
         $this->basePath = $basePath;
49 49
         $this->domain = $domain;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     ): Response {
73 73
         /** @var CookieQueue $cookieQueue */
74 74
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
75
-        if ($cookieQueue === null) {
75
+        if ($cookieQueue === null){
76 76
             return $response->withAddedHeader(
77 77
                 'Set-Cookie',
78 78
                 Cookie::create(
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
             );
89 89
         }
90 90
 
91
-        if ($tokenID === null) {
91
+        if ($tokenID === null){
92 92
             $cookieQueue->delete($this->cookie);
93
-        } else {
93
+        }else{
94 94
             $cookieQueue->set(
95 95
                 $this->cookie,
96 96
                 $tokenID,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     private function getLifetime(DateTimeInterface $expiresAt = null): ?int
122 122
     {
123
-        if ($expiresAt === null) {
123
+        if ($expiresAt === null){
124 124
             return null;
125 125
         }
126 126
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@  discard block
 block discarded – undo
72 72
     ): Response {
73 73
         /** @var CookieQueue $cookieQueue */
74 74
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
75
-        if ($cookieQueue === null) {
75
+        if ($cookieQueue === null)
76
+        {
76 77
             return $response->withAddedHeader(
77 78
                 'Set-Cookie',
78 79
                 Cookie::create(
@@ -88,9 +89,12 @@  discard block
 block discarded – undo
88 89
             );
89 90
         }
90 91
 
91
-        if ($tokenID === null) {
92
+        if ($tokenID === null)
93
+        {
92 94
             $cookieQueue->delete($this->cookie);
93
-        } else {
95
+        }
96
+        else
97
+        {
94 98
             $cookieQueue->set(
95 99
                 $this->cookie,
96 100
                 $tokenID,
@@ -120,7 +124,8 @@  discard block
 block discarded – undo
120 124
      */
121 125
     private function getLifetime(DateTimeInterface $expiresAt = null): ?int
122 126
     {
123
-        if ($expiresAt === null) {
127
+        if ($expiresAt === null)
128
+        {
124 129
             return null;
125 130
         }
126 131
 
Please login to merge, or discard this patch.