Passed
Push — master ( e8b00c...89139c )
by Anton
07:46
created
src/DataGrid/src/GridFactory.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source)){
112 112
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 113
         }
114 114
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
     protected function getFilters($source, GridSchema $schema): array
127 127
     {
128 128
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
129
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value){
130
+            if ($schema->hasFilter($name)){
131 131
                 $filter = $schema->getFilter($name)->withValue($value);
132 132
 
133
-                if ($filter !== null) {
133
+                if ($filter !== null){
134 134
                     $source = $this->compiler->compile($source, $filter);
135 135
                     $filters[$name] = $filter->getValue();
136 136
                 }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 144
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
145
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)){
146 146
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 147
         }
148 148
 
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
     protected function getSorters($source, GridSchema $schema): array
161 161
     {
162 162
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
163
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value){
164
+            if ($schema->hasSorter($name)){
165 165
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 166
 
167
-                if ($sorter !== null) {
167
+                if ($sorter !== null){
168 168
                     $source = $this->compiler->compile($source, $sorter);
169 169
                     $sorters[$name] = $sorter->getValue();
170 170
                 }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 178
     {
179
-        if ($schema->getPaginator() !== null) {
179
+        if ($schema->getPaginator() !== null){
180 180
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 181
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 182
         }
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     protected function getPaginator($source, GridSchema $schema): array
188 188
     {
189 189
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
190
+        if (!$paginator instanceof FilterInterface){
191 191
             throw new CompilerException('Paginator can not be null');
192 192
         }
193 193
 
194 194
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
195
+        if ($withValue === null){
196 196
             throw new CompilerException('Paginator can not be null');
197 197
         }
198 198
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     protected function getOptionArray(string $option): array
212 212
     {
213 213
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
214
+        if (!is_array($result)){
215 215
             return [];
216 216
         }
217 217
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function getOption(string $option)
228 228
     {
229
-        if ($this->input->hasValue($option)) {
229
+        if ($this->input->hasValue($option)){
230 230
             return $this->input->getValue($option);
231 231
         }
232 232
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source))
112
+        {
112 113
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 114
         }
114 115
 
@@ -126,11 +127,14 @@  discard block
 block discarded – undo
126 127
     protected function getFilters($source, GridSchema $schema): array
127 128
     {
128 129
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
130
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value)
131
+        {
132
+            if ($schema->hasFilter($name))
133
+            {
131 134
                 $filter = $schema->getFilter($name)->withValue($value);
132 135
 
133
-                if ($filter !== null) {
136
+                if ($filter !== null)
137
+                {
134 138
                     $source = $this->compiler->compile($source, $filter);
135 139
                     $filters[$name] = $filter->getValue();
136 140
                 }
@@ -142,7 +146,8 @@  discard block
 block discarded – undo
142 146
 
143 147
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 148
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
149
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT))
150
+        {
146 151
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 152
         }
148 153
 
@@ -160,11 +165,14 @@  discard block
 block discarded – undo
160 165
     protected function getSorters($source, GridSchema $schema): array
161 166
     {
162 167
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
168
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value)
169
+        {
170
+            if ($schema->hasSorter($name))
171
+            {
165 172
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 173
 
167
-                if ($sorter !== null) {
174
+                if ($sorter !== null)
175
+                {
168 176
                     $source = $this->compiler->compile($source, $sorter);
169 177
                     $sorters[$name] = $sorter->getValue();
170 178
                 }
@@ -176,7 +184,8 @@  discard block
 block discarded – undo
176 184
 
177 185
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 186
     {
179
-        if ($schema->getPaginator() !== null) {
187
+        if ($schema->getPaginator() !== null)
188
+        {
180 189
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 190
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 191
         }
@@ -187,12 +196,14 @@  discard block
 block discarded – undo
187 196
     protected function getPaginator($source, GridSchema $schema): array
188 197
     {
189 198
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
199
+        if (!$paginator instanceof FilterInterface)
200
+        {
191 201
             throw new CompilerException('Paginator can not be null');
192 202
         }
193 203
 
194 204
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
205
+        if ($withValue === null)
206
+        {
196 207
             throw new CompilerException('Paginator can not be null');
197 208
         }
198 209
 
@@ -211,7 +222,8 @@  discard block
 block discarded – undo
211 222
     protected function getOptionArray(string $option): array
212 223
     {
213 224
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
225
+        if (!is_array($result))
226
+        {
215 227
             return [];
216 228
         }
217 229
 
@@ -226,7 +238,8 @@  discard block
 block discarded – undo
226 238
      */
227 239
     protected function getOption(string $option)
228 240
     {
229
-        if ($this->input->hasValue($option)) {
241
+        if ($this->input->hasValue($option))
242
+        {
230 243
             return $this->input->getValue($option);
231 244
         }
232 245
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/DatetimeFormatValue.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,19 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try{
48 48
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
49
+            if (!$datetime instanceof DateTimeImmutable){
50 50
                 return null;
51 51
             }
52 52
 
53
-            if ($this->convertInto !== null) {
53
+            if ($this->convertInto !== null){
54 54
                 $formatted = $datetime->format($this->convertInto);
55 55
                 return is_string($formatted) ? $formatted : null;
56 56
             }
57 57
 
58 58
             return $datetime;
59
-        } catch (Throwable $e) {
59
+        }catch (Throwable $e){
60 60
             return null;
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,24 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try
48
+        {
48 49
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
50
+            if (!$datetime instanceof DateTimeImmutable)
51
+            {
50 52
                 return null;
51 53
             }
52 54
 
53
-            if ($this->convertInto !== null) {
55
+            if ($this->convertInto !== null)
56
+            {
54 57
                 $formatted = $datetime->format($this->convertInto);
55 58
                 return is_string($formatted) ? $formatted : null;
56 59
             }
57 60
 
58 61
             return $datetime;
59
-        } catch (Throwable $e) {
62
+        }
63
+        catch (Throwable $e)
64
+        {
60 65
             return null;
61 66
         }
62 67
     }
Please login to merge, or discard this patch.
src/Validation/src/Checker/DatetimeChecker.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value)){
86 86
             return false;
87 87
         }
88 88
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function timezone($value): bool
112 112
     {
113
-        if (!is_scalar($value)) {
113
+        if (!is_scalar($value)){
114 114
             return false;
115 115
         }
116 116
 
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function now(): ?\DateTimeInterface
152 152
     {
153
-        try {
153
+        try{
154 154
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
155
+        }catch (\Throwable $e){
156 156
             //here's the fail;
157 157
         }
158 158
 
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function date($value): ?\DateTimeInterface
167 167
     {
168
-        if (is_callable($value)) {
168
+        if (is_callable($value)){
169 169
             $value = $value();
170 170
         }
171 171
 
172
-        if ($value instanceof \DateTimeInterface) {
172
+        if ($value instanceof \DateTimeInterface){
173 173
             return $value;
174 174
         }
175 175
 
176
-        if (!$this->isApplicableValue($value)) {
176
+        if (!$this->isApplicableValue($value)){
177 177
             return null;
178 178
         }
179 179
 
180
-        try {
181
-            if (!$value) {
180
+        try{
181
+            if (!$value){
182 182
                 $value = '0';
183 183
             }
184 184
 
185 185
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
186
+        }catch (\Throwable $e){
187 187
             //here's the fail;
188 188
         }
189 189
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function fromField(string $field): ?\DateTimeInterface
207 207
     {
208 208
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
209
+        if ($before !== null){
210 210
             return $this->date($before);
211 211
         }
212 212
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value))
86
+        {
86 87
             return false;
87 88
         }
88 89
 
@@ -110,7 +111,8 @@  discard block
 block discarded – undo
110 111
      */
111 112
     public function timezone($value): bool
112 113
     {
113
-        if (!is_scalar($value)) {
114
+        if (!is_scalar($value))
115
+        {
114 116
             return false;
115 117
         }
116 118
 
@@ -150,9 +152,12 @@  discard block
 block discarded – undo
150 152
      */
151 153
     private function now(): ?\DateTimeInterface
152 154
     {
153
-        try {
155
+        try
156
+        {
154 157
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
158
+        }
159
+        catch (\Throwable $e)
160
+        {
156 161
             //here's the fail;
157 162
         }
158 163
 
@@ -165,25 +170,32 @@  discard block
 block discarded – undo
165 170
      */
166 171
     private function date($value): ?\DateTimeInterface
167 172
     {
168
-        if (is_callable($value)) {
173
+        if (is_callable($value))
174
+        {
169 175
             $value = $value();
170 176
         }
171 177
 
172
-        if ($value instanceof \DateTimeInterface) {
178
+        if ($value instanceof \DateTimeInterface)
179
+        {
173 180
             return $value;
174 181
         }
175 182
 
176
-        if (!$this->isApplicableValue($value)) {
183
+        if (!$this->isApplicableValue($value))
184
+        {
177 185
             return null;
178 186
         }
179 187
 
180
-        try {
181
-            if (!$value) {
188
+        try
189
+        {
190
+            if (!$value)
191
+            {
182 192
                 $value = '0';
183 193
             }
184 194
 
185 195
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
196
+        }
197
+        catch (\Throwable $e)
198
+        {
187 199
             //here's the fail;
188 200
         }
189 201
 
@@ -206,7 +218,8 @@  discard block
 block discarded – undo
206 218
     private function fromField(string $field): ?\DateTimeInterface
207 219
     {
208 220
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
221
+        if ($before !== null)
222
+        {
210 223
             return $this->date($before);
211 224
         }
212 225
 
Please login to merge, or discard this patch.
src/Validation/tests/Checkers/DatetimeTest.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             [true, $callableNow, $now, true, true]
45 45
         ];
46 46
 
47
-        $callableFutureTime = static function () {
47
+        $callableFutureTime = static function (){
48 48
             return time() + 1000;
49 49
         };
50 50
         yield from [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             [false, $callableFutureTime, $now, true, true],
53 53
         ];
54 54
 
55
-        $callablePastTime = static function () {
55
+        $callablePastTime = static function (){
56 56
             return time() - 1000;
57 57
         };
58 58
         yield from [
@@ -231,24 +231,24 @@  discard block
 block discarded – undo
231 231
     public function validProvider(): array
232 232
     {
233 233
         return [
234
-            [true, time() - 1000,],
235
-            [true, time(),],
236
-            [true, date('u'),],
237
-            [true, time() + 1000,],
238
-            [true, '',],
239
-            [true, 'tomorrow +2hours',],
240
-            [true, 'yesterday -2hours',],
241
-            [true, 'now',],
242
-            [true, 'now + 1000 seconds',],
243
-            [true, 'now - 1000 seconds',],
244
-            [true, 0,],
245
-            [true, 1.1,],
246
-            [false, [],],
247
-            [false, false,],
248
-            [false, true,],
249
-            [false, null,],
250
-            [false, [],],
251
-            [false, new \stdClass(),],
234
+            [true, time() - 1000, ],
235
+            [true, time(), ],
236
+            [true, date('u'), ],
237
+            [true, time() + 1000, ],
238
+            [true, '', ],
239
+            [true, 'tomorrow +2hours', ],
240
+            [true, 'yesterday -2hours', ],
241
+            [true, 'now', ],
242
+            [true, 'now + 1000 seconds', ],
243
+            [true, 'now - 1000 seconds', ],
244
+            [true, 0, ],
245
+            [true, 1.1, ],
246
+            [false, [], ],
247
+            [false, false, ],
248
+            [false, true, ],
249
+            [false, null, ],
250
+            [false, [], ],
251
+            [false, new \stdClass(), ],
252 252
         ];
253 253
     }
254 254
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $checker = new DatetimeChecker();
258 258
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
259
+        foreach (\DateTimeZone::listIdentifiers() as $identifier){
260 260
             $this->assertTrue($checker->timezone($identifier));
261 261
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 262
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
     private function now(): \Closure
399 399
     {
400
-        return static function () {
400
+        return static function (){
401 401
             return \time();
402 402
         };
403 403
     }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
     public function nowProvider(): iterable
36 36
     {
37 37
         $now = new \DateTime();
38
-        $callableNow = static function () use ($now) {
38
+        $callableNow = static function () use ($now)
39
+        {
39 40
             return $now;
40 41
         };
41 42
 
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
             [true, $callableNow, $now, true, true]
45 46
         ];
46 47
 
47
-        $callableFutureTime = static function () {
48
+        $callableFutureTime = static function ()
49
+        {
48 50
             return time() + 1000;
49 51
         };
50 52
         yield from [
@@ -52,7 +54,8 @@  discard block
 block discarded – undo
52 54
             [false, $callableFutureTime, $now, true, true],
53 55
         ];
54 56
 
55
-        $callablePastTime = static function () {
57
+        $callablePastTime = static function ()
58
+        {
56 59
             return time() - 1000;
57 60
         };
58 61
         yield from [
@@ -256,7 +259,8 @@  discard block
 block discarded – undo
256 259
     {
257 260
         $checker = new DatetimeChecker();
258 261
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
262
+        foreach (\DateTimeZone::listIdentifiers() as $identifier)
263
+        {
260 264
             $this->assertTrue($checker->timezone($identifier));
261 265
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 266
         }
@@ -397,21 +401,24 @@  discard block
 block discarded – undo
397 401
 
398 402
     private function now(): \Closure
399 403
     {
400
-        return static function () {
404
+        return static function ()
405
+        {
401 406
             return \time();
402 407
         };
403 408
     }
404 409
 
405 410
     private function inFuture(int $seconds): \Closure
406 411
     {
407
-        return static function () use ($seconds) {
412
+        return static function () use ($seconds)
413
+        {
408 414
             return \time() + $seconds;
409 415
         };
410 416
     }
411 417
 
412 418
     private function inPast(int $seconds): \Closure
413 419
     {
414
-        return static function () use ($seconds) {
420
+        return static function () use ($seconds)
421
+        {
415 422
             return \time() - $seconds;
416 423
         };
417 424
     }
Please login to merge, or discard this patch.
src/Framework/Domain/PipelineInterceptor.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext){
48 48
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 49
         }
50 50
 
51 51
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
52
+        if (!empty($pipeline)){
53
+            if ($core instanceof InterceptorPipeline){
54 54
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
55
+            }else{
56 56
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
57
+                foreach ($pipeline as $interceptor){
58 58
                     $core->addInterceptor($interceptor);
59 59
                 }
60 60
             }
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private function readAnnotation(string $controller, string $action): Pipeline
72 72
     {
73
-        try {
73
+        try{
74 74
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
75
+        }catch (\ReflectionException $e){
76 76
             return new Pipeline();
77 77
         }
78 78
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 93
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
94
+        foreach ($oldInterceptors as $interceptor){
95 95
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
96
+            if ($interceptor instanceof self){
97 97
                 break;
98 98
             }
99 99
         }
100 100
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
101
+        if (count($newInterceptors) !== count($oldInterceptors)){
102 102
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 103
         }
104 104
         $pipelineReflection->setAccessible(false);
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 
112 112
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 113
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
114
+        foreach ($oldInterceptors as $interceptor){
115 115
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
116
+            if ($interceptor instanceof self){
117
+                foreach ($interceptors as $newInterceptor){
118 118
                     $newInterceptors[] = $newInterceptor;
119 119
                 }
120 120
             }
121 121
         }
122 122
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
123
+        if (count($newInterceptors) !== count($oldInterceptors)){
124 124
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 125
         }
126 126
         $pipelineReflection->setAccessible(false);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 136
     {
137 137
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
138
+        if (!array_key_exists($key, $this->cache)){
139 139
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 140
         }
141 141
 
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 150
     {
151 151
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
152
+        foreach ($annotation->pipeline as $interceptor){
153
+            try{
154 154
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
155
+            }catch (\Throwable $e){
156 156
             }
157 157
         }
158 158
 
Please login to merge, or discard this patch.
Braces   +39 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,23 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext)
48
+        {
48 49
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 50
         }
50 51
 
51 52
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
53
+        if (!empty($pipeline))
54
+        {
55
+            if ($core instanceof InterceptorPipeline)
56
+            {
54 57
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
58
+            }
59
+            else
60
+            {
56 61
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
62
+                foreach ($pipeline as $interceptor)
63
+                {
58 64
                     $core->addInterceptor($interceptor);
59 65
                 }
60 66
             }
@@ -70,9 +76,12 @@  discard block
 block discarded – undo
70 76
      */
71 77
     private function readAnnotation(string $controller, string $action): Pipeline
72 78
     {
73
-        try {
79
+        try
80
+        {
74 81
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
82
+        }
83
+        catch (\ReflectionException $e)
84
+        {
76 85
             return new Pipeline();
77 86
         }
78 87
 
@@ -91,14 +100,17 @@  discard block
 block discarded – undo
91 100
 
92 101
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 102
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
103
+        foreach ($oldInterceptors as $interceptor)
104
+        {
95 105
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
106
+            if ($interceptor instanceof self)
107
+            {
97 108
                 break;
98 109
             }
99 110
         }
100 111
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
112
+        if (count($newInterceptors) !== count($oldInterceptors))
113
+        {
102 114
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 115
         }
104 116
         $pipelineReflection->setAccessible(false);
@@ -111,16 +123,20 @@  discard block
 block discarded – undo
111 123
 
112 124
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 125
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
126
+        foreach ($oldInterceptors as $interceptor)
127
+        {
115 128
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
129
+            if ($interceptor instanceof self)
130
+            {
131
+                foreach ($interceptors as $newInterceptor)
132
+                {
118 133
                     $newInterceptors[] = $newInterceptor;
119 134
                 }
120 135
             }
121 136
         }
122 137
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
138
+        if (count($newInterceptors) !== count($oldInterceptors))
139
+        {
124 140
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 141
         }
126 142
         $pipelineReflection->setAccessible(false);
@@ -135,7 +151,8 @@  discard block
 block discarded – undo
135 151
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 152
     {
137 153
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
154
+        if (!array_key_exists($key, $this->cache))
155
+        {
139 156
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 157
         }
141 158
 
@@ -149,10 +166,14 @@  discard block
 block discarded – undo
149 166
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 167
     {
151 168
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
169
+        foreach ($annotation->pipeline as $interceptor)
170
+        {
171
+            try
172
+            {
154 173
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
174
+            }
175
+            catch (\Throwable $e)
176
+            {
156 177
             }
157 178
         }
158 179
 
Please login to merge, or discard this patch.
src/Bridge/DataGrid/src/Bootloader/GridBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
      */
67 67
     public function compiler(ContainerInterface $container, Compiler $compiler, GridConfig $config): Compiler
68 68
     {
69
-        if ($container->has(DatabaseInterface::class)) {
70
-            foreach ($config->getWriters() as $writer) {
69
+        if ($container->has(DatabaseInterface::class)){
70
+            foreach ($config->getWriters() as $writer){
71 71
                 $compiler->addWriter($container->get($writer));
72 72
             }
73 73
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,10 @@
 block discarded – undo
66 66
      */
67 67
     public function compiler(ContainerInterface $container, Compiler $compiler, GridConfig $config): Compiler
68 68
     {
69
-        if ($container->has(DatabaseInterface::class)) {
70
-            foreach ($config->getWriters() as $writer) {
69
+        if ($container->has(DatabaseInterface::class))
70
+        {
71
+            foreach ($config->getWriters() as $writer)
72
+            {
71 73
                 $compiler->addWriter($container->get($writer));
72 74
             }
73 75
         }
Please login to merge, or discard this patch.
src/Bridge/DataGrid/src/Writer/BetweenWriter.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function write($source, SpecificationInterface $specification, Compiler $compiler)
37 37
     {
38
-        if ($specification instanceof Filter\Between || $specification instanceof Filter\ValueBetween) {
38
+        if ($specification instanceof Filter\Between || $specification instanceof Filter\ValueBetween){
39 39
             $filters = $specification->getFilters($this->asOriginal);
40
-            if (count($filters) > 1) {
40
+            if (count($filters) > 1){
41 41
                 return $source->where(static function () use ($compiler, $source, $filters): void {
42 42
                     $compiler->compile($source, ...$filters);
43 43
                 });
44 44
             }
45 45
         }
46 46
 
47
-        if ($specification instanceof Filter\InjectionFilter) {
47
+        if ($specification instanceof Filter\InjectionFilter){
48 48
             $expression = $specification->getFilter();
49
-            if ($expression instanceof Filter\Between) {
49
+            if ($expression instanceof Filter\Between){
50 50
                 $filters = $expression->getFilters($this->asOriginal);
51
-                if (count($filters) > 1) {
51
+                if (count($filters) > 1){
52 52
                     $filters = array_map(
53 53
                         static function (SpecificationInterface $filter) use ($specification): Filter\InjectionFilter {
54 54
                             return Filter\InjectionFilter::createFrom($specification, $filter);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             }
72 72
         }
73 73
 
74
-        if ($specification instanceof Filter\Between) {
74
+        if ($specification instanceof Filter\Between){
75 75
             return $source->where(
76 76
                 $specification->getExpression(),
77 77
                 'BETWEEN',
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             );
80 80
         }
81 81
 
82
-        if ($specification instanceof Filter\ValueBetween) {
82
+        if ($specification instanceof Filter\ValueBetween){
83 83
             return $source->where(
84 84
                 new Parameter($specification->getValue()),
85 85
                 'BETWEEN',
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,20 +35,25 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function write($source, SpecificationInterface $specification, Compiler $compiler)
37 37
     {
38
-        if ($specification instanceof Filter\Between || $specification instanceof Filter\ValueBetween) {
38
+        if ($specification instanceof Filter\Between || $specification instanceof Filter\ValueBetween)
39
+        {
39 40
             $filters = $specification->getFilters($this->asOriginal);
40
-            if (count($filters) > 1) {
41
+            if (count($filters) > 1)
42
+            {
41 43
                 return $source->where(static function () use ($compiler, $source, $filters): void {
42 44
                     $compiler->compile($source, ...$filters);
43 45
                 });
44 46
             }
45 47
         }
46 48
 
47
-        if ($specification instanceof Filter\InjectionFilter) {
49
+        if ($specification instanceof Filter\InjectionFilter)
50
+        {
48 51
             $expression = $specification->getFilter();
49
-            if ($expression instanceof Filter\Between) {
52
+            if ($expression instanceof Filter\Between)
53
+            {
50 54
                 $filters = $expression->getFilters($this->asOriginal);
51
-                if (count($filters) > 1) {
55
+                if (count($filters) > 1)
56
+                {
52 57
                     $filters = array_map(
53 58
                         static function (SpecificationInterface $filter) use ($specification): Filter\InjectionFilter {
54 59
                             return Filter\InjectionFilter::createFrom($specification, $filter);
@@ -71,7 +76,8 @@  discard block
 block discarded – undo
71 76
             }
72 77
         }
73 78
 
74
-        if ($specification instanceof Filter\Between) {
79
+        if ($specification instanceof Filter\Between)
80
+        {
75 81
             return $source->where(
76 82
                 $specification->getExpression(),
77 83
                 'BETWEEN',
@@ -79,7 +85,8 @@  discard block
 block discarded – undo
79 85
             );
80 86
         }
81 87
 
82
-        if ($specification instanceof Filter\ValueBetween) {
88
+        if ($specification instanceof Filter\ValueBetween)
89
+        {
83 90
             return $source->where(
84 91
                 new Parameter($specification->getValue()),
85 92
                 'BETWEEN',
Please login to merge, or discard this patch.
src/Bridge/DataGrid/src/Response/GridResponse.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function jsonSerialize(): array
47 47
     {
48
-        if ($this->grid === null) {
48
+        if ($this->grid === null){
49 49
             return [
50 50
                 'status' => 500,
51 51
                 'error'  => 'missing-grid-source',
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
             $this->option('property', 'data') => $this->data,
58 58
         ];
59 59
 
60
-        if ($this->grid->getOption(GridInterface::PAGINATOR) !== null) {
60
+        if ($this->grid->getOption(GridInterface::PAGINATOR) !== null){
61 61
             $response['pagination'] = $this->grid->getOption(GridInterface::PAGINATOR);
62 62
         }
63 63
 
64
-        if (isset($response['pagination']) && $this->grid->getOption(GridInterface::COUNT) !== null) {
64
+        if (isset($response['pagination']) && $this->grid->getOption(GridInterface::COUNT) !== null){
65 65
             $response['pagination']['count'] = $this->grid->getOption(GridInterface::COUNT);
66 66
         }
67 67
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function jsonSerialize(): array
47 47
     {
48
-        if ($this->grid === null) {
48
+        if ($this->grid === null)
49
+        {
49 50
             return [
50 51
                 'status' => 500,
51 52
                 'error'  => 'missing-grid-source',
@@ -57,11 +58,13 @@  discard block
 block discarded – undo
57 58
             $this->option('property', 'data') => $this->data,
58 59
         ];
59 60
 
60
-        if ($this->grid->getOption(GridInterface::PAGINATOR) !== null) {
61
+        if ($this->grid->getOption(GridInterface::PAGINATOR) !== null)
62
+        {
61 63
             $response['pagination'] = $this->grid->getOption(GridInterface::PAGINATOR);
62 64
         }
63 65
 
64
-        if (isset($response['pagination']) && $this->grid->getOption(GridInterface::COUNT) !== null) {
66
+        if (isset($response['pagination']) && $this->grid->getOption(GridInterface::COUNT) !== null)
67
+        {
65 68
             $response['pagination']['count'] = $this->grid->getOption(GridInterface::COUNT);
66 69
         }
67 70
 
Please login to merge, or discard this patch.
src/Bridge/DataGrid/src/Specification/Filter/InjectionFilter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function __construct(SpecificationInterface $expression)
27 27
     {
28
-        if (!$expression instanceof Expression && !$expression instanceof Between) {
28
+        if (!$expression instanceof Expression && !$expression instanceof Between){
29 29
             throw new LogicException('Only expression filters allowed');
30 30
         }
31 31
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
 
26 26
     public function __construct(SpecificationInterface $expression)
27 27
     {
28
-        if (!$expression instanceof Expression && !$expression instanceof Between) {
28
+        if (!$expression instanceof Expression && !$expression instanceof Between)
29
+        {
29 30
             throw new LogicException('Only expression filters allowed');
30 31
         }
31 32
 
Please login to merge, or discard this patch.