Passed
Pull Request — master (#383)
by Valentin
06:35
created
src/DataGrid/tests/GridFactoryTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $expected,
242 242
         string $expectedException = null
243 243
     ): void {
244
-        if ($expectedException !== null) {
244
+        if ($expectedException !== null){
245 245
             $this->expectException($expectedException);
246 246
         }
247 247
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             new Gte('price', new Value\FloatValue())
301 301
         );
302 302
         $schema->addWrappedFilters(
303
-            static function (FilterInterface ...$filters) {
303
+            static function (FilterInterface ...$filters){
304 304
                 return new Any(...$filters);
305 305
             },
306 306
             'size',
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
     private function paginatorInput(int $page = null, int $limit = null): array
373 373
     {
374 374
         $result = [];
375
-        if ($page === null && $limit === null) {
375
+        if ($page === null && $limit === null){
376 376
             return $result;
377 377
         }
378 378
 
379
-        if ($page !== null) {
379
+        if ($page !== null){
380 380
             $result['page'] = $page;
381 381
         }
382 382
 
383
-        if ($limit !== null) {
383
+        if ($limit !== null){
384 384
             $result['limit'] = $limit;
385 385
         }
386 386
 
Please login to merge, or discard this patch.
src/DataGrid/tests/Fixture/WrapWriter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function write($source, SpecificationInterface $specification, Compiler $compiler)
23 23
     {
24
-        if (is_array($source)) {
24
+        if (is_array($source)){
25 25
             $source[] = $specification;
26 26
         }
27 27
 
Please login to merge, or discard this patch.
src/DataGrid/src/GridFactory.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $values = [];
129 129
         $filters = [];
130
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
131
-            if ($schema->hasFilter($name)) {
130
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value){
131
+            if ($schema->hasFilter($name)){
132 132
                 $filter = $schema->getFilter($name)->withValue($value);
133 133
 
134
-                if ($filter !== null) {
134
+                if ($filter !== null){
135 135
                     $filters[$name] = $filter;
136 136
                     $values[$name] = $filter->getValue();
137 137
                 }
138 138
             }
139 139
         }
140 140
 
141
-        foreach ($schema->wrapFilters($filters) as $filter) {
141
+        foreach ($schema->wrapFilters($filters) as $filter){
142 142
             $source = $this->compiler->compile($source, $filter);
143 143
         }
144 144
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
149 149
     {
150
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
150
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)){
151 151
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
152 152
         }
153 153
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
     protected function getSorters($source, GridSchema $schema): array
166 166
     {
167 167
         $sorters = [];
168
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
169
-            if ($schema->hasSorter($name)) {
168
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value){
169
+            if ($schema->hasSorter($name)){
170 170
                 $sorter = $schema->getSorter($name)->withDirection($value);
171 171
 
172
-                if ($sorter !== null) {
172
+                if ($sorter !== null){
173 173
                     $source = $this->compiler->compile($source, $sorter);
174 174
                     $sorters[$name] = $sorter->getValue();
175 175
                 }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
183 183
     {
184
-        if ($schema->getPaginator() !== null) {
184
+        if ($schema->getPaginator() !== null){
185 185
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
186 186
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
187 187
         }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
     protected function getPaginator($source, GridSchema $schema): array
193 193
     {
194 194
         $paginator = $schema->getPaginator();
195
-        if (!$paginator instanceof FilterInterface) {
195
+        if (!$paginator instanceof FilterInterface){
196 196
             throw new CompilerException('Paginator can not be null');
197 197
         }
198 198
 
199 199
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
200
-        if ($withValue === null) {
200
+        if ($withValue === null){
201 201
             throw new CompilerException('Paginator can not be null');
202 202
         }
203 203
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     protected function getOptionArray(string $option): array
217 217
     {
218 218
         $result = $this->getOption($option);
219
-        if (!is_array($result)) {
219
+        if (!is_array($result)){
220 220
             return [];
221 221
         }
222 222
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     protected function getOption(string $option)
233 233
     {
234
-        if ($this->input->hasValue($option)) {
234
+        if ($this->input->hasValue($option)){
235 235
             return $this->input->getValue($option);
236 236
         }
237 237
 
Please login to merge, or discard this patch.
src/DataGrid/src/GridSchema.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function addWrappedFilters(callable $wrapper, string ...$filters): void
42 42
     {
43
-        foreach ($filters as $filter) {
44
-            if (isset($this->wrappedFilters[$filter])) {
43
+        foreach ($filters as $filter){
44
+            if (isset($this->wrappedFilters[$filter])){
45 45
                 throw new SchemaException("Filter `$filter` is already wrapped");
46 46
             }
47 47
         }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
     public function wrapFilters(array $input): array
54 54
     {
55 55
         $output = [];
56
-        foreach ($this->wrappers as $wrapper) {
56
+        foreach ($this->wrappers as $wrapper){
57 57
             $output[] = $wrapper['wrapper'](...$this->fetchFilters($input, $wrapper['filters']));
58
-            foreach ($input as $name => $filter) {
59
-                if (!in_array($name, $wrapper['filters'], true)) {
58
+            foreach ($input as $name => $filter){
59
+                if (!in_array($name, $wrapper['filters'], true)){
60 60
                     $output[] = $filter;
61 61
                 }
62 62
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function addFilter(string $name, FilterInterface $filter): void
76 76
     {
77
-        if ($this->hasFilter($name)) {
77
+        if ($this->hasFilter($name)){
78 78
             throw new SchemaException("Filter `$name` is already defined");
79 79
         }
80 80
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function getFilter(string $name): FilterInterface
101 101
     {
102
-        if (!$this->hasFilter($name)) {
102
+        if (!$this->hasFilter($name)){
103 103
             throw new SchemaException("No such filter `$name`");
104 104
         }
105 105
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function addSorter(string $name, SorterInterface $sorter): void
125 125
     {
126
-        if ($this->hasSorter($name)) {
126
+        if ($this->hasSorter($name)){
127 127
             throw new SchemaException("Sorter `$name` is already defined");
128 128
         }
129 129
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function getSorter(string $name): SorterInterface
150 150
     {
151
-        if (!$this->hasSorter($name)) {
151
+        if (!$this->hasSorter($name)){
152 152
             throw new SchemaException("No such sorter `$name`");
153 153
         }
154 154
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     private function fetchFilters(array $filters, array $names): array
187 187
     {
188 188
         $output = [];
189
-        foreach ($names as $name) {
189
+        foreach ($names as $name){
190 190
             $output[] = $filters[$name] ?? new NullFilter();
191 191
         }
192 192
 
Please login to merge, or discard this patch.