Passed
Pull Request — master (#383)
by Valentin
04:26
created
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   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function wrapFilters(array $input): array
43 43
     {
44
-        if (!$this->wrapper) {
44
+        if (!$this->wrapper){
45 45
             return $input;
46 46
         }
47 47
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function addFilter(string $name, FilterInterface $filter): void
60 60
     {
61
-        if ($this->hasFilter($name)) {
61
+        if ($this->hasFilter($name)){
62 62
             throw new SchemaException("Filter `$name` is already defined");
63 63
         }
64 64
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function getFilter(string $name): FilterInterface
85 85
     {
86
-        if (!$this->hasFilter($name)) {
86
+        if (!$this->hasFilter($name)){
87 87
             throw new SchemaException("No such filter `$name`");
88 88
         }
89 89
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function addSorter(string $name, SorterInterface $sorter): void
109 109
     {
110
-        if ($this->hasSorter($name)) {
110
+        if ($this->hasSorter($name)){
111 111
             throw new SchemaException("Sorter `$name` is already defined");
112 112
         }
113 113
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getSorter(string $name): SorterInterface
134 134
     {
135
-        if (!$this->hasSorter($name)) {
135
+        if (!$this->hasSorter($name)){
136 136
             throw new SchemaException("No such sorter `$name`");
137 137
         }
138 138
 
Please login to merge, or discard this patch.
src/DataGrid/tests/GridFactoryTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         $expected,
241 241
         string $expectedException = null
242 242
     ): void {
243
-        if ($expectedException !== null) {
243
+        if ($expectedException !== null){
244 244
             $this->expectException($expectedException);
245 245
         }
246 246
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             function (array $filters): array {
303 303
                 $size = $filters['size'] ?? null;
304 304
                 $color = $filters['color'] ?? null;
305
-                if ($size && $color) {
305
+                if ($size && $color){
306 306
                     unset($filters['size'], $filters['color']);
307 307
                     $filters[] = new Any($size, $color);
308 308
                 }
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
     private function paginatorInput(int $page = null, int $limit = null): array
369 369
     {
370 370
         $result = [];
371
-        if ($page === null && $limit === null) {
371
+        if ($page === null && $limit === null){
372 372
             return $result;
373 373
         }
374 374
 
375
-        if ($page !== null) {
375
+        if ($page !== null){
376 376
             $result['page'] = $page;
377 377
         }
378 378
 
379
-        if ($limit !== null) {
379
+        if ($limit !== null){
380 380
             $result['limit'] = $limit;
381 381
         }
382 382
 
Please login to merge, or discard this patch.