Passed
Push — master ( c776c7...570285 )
by Kirill
04:05
created
src/DataGrid/src/Specification/Value/ArrayValue.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function accepts($value): bool
34 34
     {
35
-        if (!is_array($value)) {
35
+        if (!is_array($value)){
36 36
             return false;
37 37
         }
38 38
 
39
-        foreach ($value as $child) {
40
-            if (!$this->base->accepts($child)) {
39
+        foreach ($value as $child){
40
+            if (!$this->base->accepts($child)){
41 41
                 return false;
42 42
             }
43 43
         }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function convert($value): array
53 53
     {
54 54
         $result = [];
55
-        foreach ($value as $child) {
55
+        foreach ($value as $child){
56 56
             $result[] = $this->base->convert($child);
57 57
         }
58 58
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,12 +32,15 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function accepts($value): bool
34 34
     {
35
-        if (!is_array($value)) {
35
+        if (!is_array($value))
36
+        {
36 37
             return false;
37 38
         }
38 39
 
39
-        foreach ($value as $child) {
40
-            if (!$this->base->accepts($child)) {
40
+        foreach ($value as $child)
41
+        {
42
+            if (!$this->base->accepts($child))
43
+            {
41 44
                 return false;
42 45
             }
43 46
         }
@@ -52,7 +55,8 @@  discard block
 block discarded – undo
52 55
     public function convert($value): array
53 56
     {
54 57
         $result = [];
55
-        foreach ($value as $child) {
58
+        foreach ($value as $child)
59
+        {
56 60
             $result[] = $this->base->convert($child);
57 61
         }
58 62
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/NotEmpty.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function accepts($value): bool
32 32
     {
33
-        if (empty($value)) {
33
+        if (empty($value)){
34 34
             return false;
35 35
         }
36 36
 
37
-        if ($this->value instanceof ValueInterface) {
37
+        if ($this->value instanceof ValueInterface){
38 38
             return $this->value->accepts($value);
39 39
         }
40 40
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function convert($value)
48 48
     {
49
-        if ($this->value instanceof ValueInterface) {
49
+        if ($this->value instanceof ValueInterface){
50 50
             return $this->value->convert($value);
51 51
         }
52 52
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,11 +30,13 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function accepts($value): bool
32 32
     {
33
-        if (empty($value)) {
33
+        if (empty($value))
34
+        {
34 35
             return false;
35 36
         }
36 37
 
37
-        if ($this->value instanceof ValueInterface) {
38
+        if ($this->value instanceof ValueInterface)
39
+        {
38 40
             return $this->value->accepts($value);
39 41
         }
40 42
 
@@ -46,7 +48,8 @@  discard block
 block discarded – undo
46 48
      */
47 49
     public function convert($value)
48 50
     {
49
-        if ($this->value instanceof ValueInterface) {
51
+        if ($this->value instanceof ValueInterface)
52
+        {
50 53
             return $this->value->convert($value);
51 54
         }
52 55
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Pagination/PagePaginator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     public function withValue($value): ?SpecificationInterface
52 52
     {
53 53
         $paginator = clone $this;
54
-        if (!is_array($value)) {
54
+        if (!is_array($value)){
55 55
             return $paginator;
56 56
         }
57 57
 
58
-        if (isset($value['limit']) && $paginator->limitValue->accepts($value['limit'])) {
58
+        if (isset($value['limit']) && $paginator->limitValue->accepts($value['limit'])){
59 59
             $paginator->limit = $paginator->limitValue->convert($value['limit']);
60 60
         }
61 61
 
62
-        if (isset($value['page']) && is_numeric($value['page'])) {
62
+        if (isset($value['page']) && is_numeric($value['page'])){
63 63
             $paginator->page = max((int)$value['page'], 1);
64 64
         }
65 65
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function getSpecifications(): array
73 73
     {
74 74
         $specifications = [new Limit($this->limit)];
75
-        if ($this->page > 1) {
75
+        if ($this->page > 1){
76 76
             $specifications[] = new Offset($this->limit * ($this->page - 1));
77 77
         }
78 78
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,15 +51,18 @@  discard block
 block discarded – undo
51 51
     public function withValue($value): ?SpecificationInterface
52 52
     {
53 53
         $paginator = clone $this;
54
-        if (!is_array($value)) {
54
+        if (!is_array($value))
55
+        {
55 56
             return $paginator;
56 57
         }
57 58
 
58
-        if (isset($value['limit']) && $paginator->limitValue->accepts($value['limit'])) {
59
+        if (isset($value['limit']) && $paginator->limitValue->accepts($value['limit']))
60
+        {
59 61
             $paginator->limit = $paginator->limitValue->convert($value['limit']);
60 62
         }
61 63
 
62
-        if (isset($value['page']) && is_numeric($value['page'])) {
64
+        if (isset($value['page']) && is_numeric($value['page']))
65
+        {
63 66
             $paginator->page = max((int)$value['page'], 1);
64 67
         }
65 68
 
@@ -72,7 +75,8 @@  discard block
 block discarded – undo
72 75
     public function getSpecifications(): array
73 76
     {
74 77
         $specifications = [new Limit($this->limit)];
75
-        if ($this->page > 1) {
78
+        if ($this->page > 1)
79
+        {
76 80
             $specifications[] = new Offset($this->limit * ($this->page - 1));
77 81
         }
78 82
 
Please login to merge, or discard this patch.
src/DataGrid/src/helpers.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function hasKey(array $array, $search): bool
23 23
 {
24
-    foreach ($array as $key => $value) {
25
-        if (equals($key, $search)) {
24
+    foreach ($array as $key => $value){
25
+        if (equals($key, $search)){
26 26
             return true;
27 27
         }
28 28
     }
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function hasValue(array $array, $search): bool
39 39
 {
40
-    foreach ($array as $key => $value) {
41
-        if (equals($value, $search)) {
40
+    foreach ($array as $key => $value){
41
+        if (equals($value, $search)){
42 42
             return true;
43 43
         }
44 44
     }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function getValue(array $array, string $search)
58 58
 {
59
-    foreach ($array as $key => $value) {
60
-        if (equals($key, $search)) {
59
+    foreach ($array as $key => $value){
60
+        if (equals($key, $search)){
61 61
             return $value;
62 62
         }
63 63
     }
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function equals($value1, $value2): bool
75 75
 {
76
-    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0) {
76
+    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0){
77 77
         return true;
78 78
     }
79 79
 
80
-    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0) {
80
+    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0){
81 81
         return true;
82 82
     }
83 83
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,10 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function hasKey(array $array, $search): bool
23 23
 {
24
-    foreach ($array as $key => $value) {
25
-        if (equals($key, $search)) {
24
+    foreach ($array as $key => $value)
25
+    {
26
+        if (equals($key, $search))
27
+        {
26 28
             return true;
27 29
         }
28 30
     }
@@ -37,8 +39,10 @@  discard block
 block discarded – undo
37 39
  */
38 40
 function hasValue(array $array, $search): bool
39 41
 {
40
-    foreach ($array as $key => $value) {
41
-        if (equals($value, $search)) {
42
+    foreach ($array as $key => $value)
43
+    {
44
+        if (equals($value, $search))
45
+        {
42 46
             return true;
43 47
         }
44 48
     }
@@ -56,8 +60,10 @@  discard block
 block discarded – undo
56 60
  */
57 61
 function getValue(array $array, string $search)
58 62
 {
59
-    foreach ($array as $key => $value) {
60
-        if (equals($key, $search)) {
63
+    foreach ($array as $key => $value)
64
+    {
65
+        if (equals($key, $search))
66
+        {
61 67
             return $value;
62 68
         }
63 69
     }
@@ -73,11 +79,13 @@  discard block
 block discarded – undo
73 79
  */
74 80
 function equals($value1, $value2): bool
75 81
 {
76
-    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0) {
82
+    if (is_string($value1) && is_string($value2) && strcasecmp($value1, $value2) === 0)
83
+    {
77 84
         return true;
78 85
     }
79 86
 
80
-    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0) {
87
+    if (is_numeric($value1) && is_numeric($value2) && strcasecmp((string)$value1, (string)$value2) === 0)
88
+    {
81 89
         return true;
82 90
     }
83 91
 
Please login to merge, or discard this patch.
src/DataGrid/src/Grid.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@
 block discarded – undo
34 34
      */
35 35
     public function getIterator(): Generator
36 36
     {
37
-        if ($this->source === null) {
37
+        if ($this->source === null){
38 38
             throw new GridViewException('GridView does not have associated data source');
39 39
         }
40 40
 
41
-        foreach ($this->source as $key => $item) {
42
-            if ($this->mapper === null) {
41
+        foreach ($this->source as $key => $item){
42
+            if ($this->mapper === null){
43 43
                 yield $key => $item;
44 44
                 continue;
45 45
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,12 +34,15 @@
 block discarded – undo
34 34
      */
35 35
     public function getIterator(): Generator
36 36
     {
37
-        if ($this->source === null) {
37
+        if ($this->source === null)
38
+        {
38 39
             throw new GridViewException('GridView does not have associated data source');
39 40
         }
40 41
 
41
-        foreach ($this->source as $key => $item) {
42
-            if ($this->mapper === null) {
42
+        foreach ($this->source as $key => $item)
43
+        {
44
+            if ($this->mapper === null)
45
+            {
43 46
                 yield $key => $item;
44 47
                 continue;
45 48
             }
Please login to merge, or discard this patch.
src/DataGrid/src/Compiler.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,25 +41,25 @@
 block discarded – undo
41 41
      */
42 42
     public function compile($source, SpecificationInterface ...$specifications)
43 43
     {
44
-        if ($source === null) {
44
+        if ($source === null){
45 45
             return null;
46 46
         }
47 47
 
48
-        foreach ($specifications as $specification) {
49
-            if ($specification instanceof SequenceInterface) {
48
+        foreach ($specifications as $specification){
49
+            if ($specification instanceof SequenceInterface){
50 50
                 return $this->compile($source, ...$specification->getSpecifications());
51 51
             }
52 52
 
53 53
             $isWritten = false;
54
-            foreach ($this->writers as $writer) {
54
+            foreach ($this->writers as $writer){
55 55
                 $result = $writer->write($source, $specification, $this);
56
-                if ($result !== null) {
56
+                if ($result !== null){
57 57
                     $source = $result;
58 58
                     $isWritten = true;
59 59
                 }
60 60
             }
61 61
 
62
-            if ($isWritten) {
62
+            if ($isWritten){
63 63
                 continue;
64 64
             }
65 65
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,25 +41,31 @@
 block discarded – undo
41 41
      */
42 42
     public function compile($source, SpecificationInterface ...$specifications)
43 43
     {
44
-        if ($source === null) {
44
+        if ($source === null)
45
+        {
45 46
             return null;
46 47
         }
47 48
 
48
-        foreach ($specifications as $specification) {
49
-            if ($specification instanceof SequenceInterface) {
49
+        foreach ($specifications as $specification)
50
+        {
51
+            if ($specification instanceof SequenceInterface)
52
+            {
50 53
                 return $this->compile($source, ...$specification->getSpecifications());
51 54
             }
52 55
 
53 56
             $isWritten = false;
54
-            foreach ($this->writers as $writer) {
57
+            foreach ($this->writers as $writer)
58
+            {
55 59
                 $result = $writer->write($source, $specification, $this);
56
-                if ($result !== null) {
60
+                if ($result !== null)
61
+                {
57 62
                     $source = $result;
58 63
                     $isWritten = true;
59 64
                 }
60 65
             }
61 66
 
62
-            if ($isWritten) {
67
+            if ($isWritten)
68
+            {
63 69
                 continue;
64 70
             }
65 71
 
Please login to merge, or discard this patch.
src/DataGrid/tests/PaginatorTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
         $paginator = $paginator->withValue($value);
56 56
 
57 57
         $specifications = [];
58
-        foreach ($paginator->getSpecifications() as $specification) {
58
+        foreach ($paginator->getSpecifications() as $specification){
59 59
             $specifications[] = get_class($specification);
60 60
         }
61 61
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@
 block discarded – undo
55 55
         $paginator = $paginator->withValue($value);
56 56
 
57 57
         $specifications = [];
58
-        foreach ($paginator->getSpecifications() as $specification) {
58
+        foreach ($paginator->getSpecifications() as $specification)
59
+        {
59 60
             $specifications[] = get_class($specification);
60 61
         }
61 62
 
Please login to merge, or discard this patch.
src/DataGrid/tests/Specification/BetweenTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function testInitValue($value, ?string $exception): void
29 29
     {
30 30
         $this->assertTrue(true);
31
-        if ($exception !== null) {
31
+        if ($exception !== null){
32 32
             $this->expectException($exception);
33 33
         }
34 34
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             new stdClass()
82 82
         ];
83 83
 
84
-        foreach ($incorrectValues as $incorrectValue) {
84
+        foreach ($incorrectValues as $incorrectValue){
85 85
             yield[[1, 2], $incorrectValue, true];
86 86
             yield[new IntValue(), $incorrectValue, false];
87 87
         }
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
     ): void {
164 164
         $filters = $between->getFilters(true);
165 165
 
166
-        if ($isOriginal) {
166
+        if ($isOriginal){
167 167
             $this->assertCount(1, $filters);
168 168
             $this->assertInstanceOf(Filter\Between::class, $filters[0]);
169
-        } else {
169
+        }else{
170 170
             $this->assertCount(2, $filters);
171 171
             $this->assertInstanceOf($from, $filters[0]);
172 172
             $this->assertInstanceOf($to, $filters[1]);
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
     public function testInitValue($value, ?string $exception): void
29 29
     {
30 30
         $this->assertTrue(true);
31
-        if ($exception !== null) {
31
+        if ($exception !== null)
32
+        {
32 33
             $this->expectException($exception);
33 34
         }
34 35
 
@@ -81,7 +82,8 @@  discard block
 block discarded – undo
81 82
             new stdClass()
82 83
         ];
83 84
 
84
-        foreach ($incorrectValues as $incorrectValue) {
85
+        foreach ($incorrectValues as $incorrectValue)
86
+        {
85 87
             yield[[1, 2], $incorrectValue, true];
86 88
             yield[new IntValue(), $incorrectValue, false];
87 89
         }
@@ -163,10 +165,13 @@  discard block
 block discarded – undo
163 165
     ): void {
164 166
         $filters = $between->getFilters(true);
165 167
 
166
-        if ($isOriginal) {
168
+        if ($isOriginal)
169
+        {
167 170
             $this->assertCount(1, $filters);
168 171
             $this->assertInstanceOf(Filter\Between::class, $filters[0]);
169
-        } else {
172
+        }
173
+        else
174
+        {
170 175
             $this->assertCount(2, $filters);
171 176
             $this->assertInstanceOf($from, $filters[0]);
172 177
             $this->assertInstanceOf($to, $filters[1]);
Please login to merge, or discard this patch.
src/DataGrid/tests/Specification/ValueBetweenTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function testInitValue($expression, array $value, ?string $exception): void
30 30
     {
31 31
         $this->assertTrue(true);
32
-        if ($exception !== null) {
32
+        if ($exception !== null){
33 33
             $this->expectException($exception);
34 34
         }
35 35
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             new stdClass()
89 89
         ];
90 90
 
91
-        foreach ($incorrectValues as $incorrectValue) {
91
+        foreach ($incorrectValues as $incorrectValue){
92 92
             yield[1, $incorrectValue, true];
93 93
             yield[new IntValue(), $incorrectValue, false];
94 94
         }
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
     ): void {
147 147
         $filters = $between->getFilters(true);
148 148
 
149
-        if ($isOriginal) {
149
+        if ($isOriginal){
150 150
             $this->assertCount(1, $filters);
151 151
             $this->assertInstanceOf(Filter\ValueBetween::class, $filters[0]);
152
-        } else {
152
+        }else{
153 153
             $this->assertCount(2, $filters);
154 154
             $this->assertInstanceOf($from, $filters[0]);
155 155
             $this->assertInstanceOf($to, $filters[1]);
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
     public function testInitValue($expression, array $value, ?string $exception): void
30 30
     {
31 31
         $this->assertTrue(true);
32
-        if ($exception !== null) {
32
+        if ($exception !== null)
33
+        {
33 34
             $this->expectException($exception);
34 35
         }
35 36
 
@@ -88,7 +89,8 @@  discard block
 block discarded – undo
88 89
             new stdClass()
89 90
         ];
90 91
 
91
-        foreach ($incorrectValues as $incorrectValue) {
92
+        foreach ($incorrectValues as $incorrectValue)
93
+        {
92 94
             yield[1, $incorrectValue, true];
93 95
             yield[new IntValue(), $incorrectValue, false];
94 96
         }
@@ -146,10 +148,13 @@  discard block
 block discarded – undo
146 148
     ): void {
147 149
         $filters = $between->getFilters(true);
148 150
 
149
-        if ($isOriginal) {
151
+        if ($isOriginal)
152
+        {
150 153
             $this->assertCount(1, $filters);
151 154
             $this->assertInstanceOf(Filter\ValueBetween::class, $filters[0]);
152
-        } else {
155
+        }
156
+        else
157
+        {
153 158
             $this->assertCount(2, $filters);
154 159
             $this->assertInstanceOf($from, $filters[0]);
155 160
             $this->assertInstanceOf($to, $filters[1]);
Please login to merge, or discard this patch.