Passed
Pull Request — master (#737)
by Vadim
08:14
created
src/DataGrid/src/Specification/Filter/Any.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
     public function withValue($value): ?SpecificationInterface
32 32
     {
33 33
         $any = $this->clone($value);
34
-        foreach ($this->filters as $filter) {
34
+        foreach ($this->filters as $filter){
35 35
             $applied = $filter->withValue($value);
36 36
 
37
-            if ($applied === null) {
37
+            if ($applied === null){
38 38
                 // all nested filters must be configured
39 39
                 continue;
40 40
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,12 @@
 block discarded – undo
31 31
     public function withValue($value): ?SpecificationInterface
32 32
     {
33 33
         $any = $this->clone($value);
34
-        foreach ($this->filters as $filter) {
34
+        foreach ($this->filters as $filter)
35
+        {
35 36
             $applied = $filter->withValue($value);
36 37
 
37
-            if ($applied === null) {
38
+            if ($applied === null)
39
+            {
38 40
                 // all nested filters must be configured
39 41
                 continue;
40 42
             }
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Filter/Select.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@
 block discarded – undo
38 38
         $select = $this->clone($value);
39 39
         $value = (array)$value;
40 40
 
41
-        foreach ($this->filters as $name => $filter) {
41
+        foreach ($this->filters as $name => $filter){
42 42
             $name = (string)$name;
43
-            if (!hasValue($value, $name)) {
43
+            if (!hasValue($value, $name)){
44 44
                 continue;
45 45
             }
46 46
 
47 47
             $select->filters[$name] = $filter;
48 48
         }
49 49
 
50
-        if (empty($select->filters)) {
50
+        if (empty($select->filters)){
51 51
             return null;
52 52
         }
53 53
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,16 +38,19 @@
 block discarded – undo
38 38
         $select = $this->clone($value);
39 39
         $value = (array)$value;
40 40
 
41
-        foreach ($this->filters as $name => $filter) {
41
+        foreach ($this->filters as $name => $filter)
42
+        {
42 43
             $name = (string)$name;
43
-            if (!hasValue($value, $name)) {
44
+            if (!hasValue($value, $name))
45
+            {
44 46
                 continue;
45 47
             }
46 48
 
47 49
             $select->filters[$name] = $filter;
48 50
         }
49 51
 
50
-        if (empty($select->filters)) {
52
+        if (empty($select->filters))
53
+        {
51 54
             return null;
52 55
         }
53 56
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Filter/All.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
     public function withValue($value): ?SpecificationInterface
32 32
     {
33 33
         $all = $this->clone($value);
34
-        foreach ($this->filters as $filter) {
34
+        foreach ($this->filters as $filter){
35 35
             $applied = $filter->withValue($value);
36 36
 
37
-            if ($applied === null) {
37
+            if ($applied === null){
38 38
                 // all nested filters must be configured
39 39
                 return null;
40 40
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,12 @@
 block discarded – undo
31 31
     public function withValue($value): ?SpecificationInterface
32 32
     {
33 33
         $all = $this->clone($value);
34
-        foreach ($this->filters as $filter) {
34
+        foreach ($this->filters as $filter)
35
+        {
35 36
             $applied = $filter->withValue($value);
36 37
 
37
-            if ($applied === null) {
38
+            if ($applied === null)
39
+            {
38 40
                 // all nested filters must be configured
39 41
                 return null;
40 42
             }
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Filter/Expression.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@
 block discarded – undo
40 40
     public function withValue($value): ?SpecificationInterface
41 41
     {
42 42
         $filter = clone $this;
43
-        if (!$filter->value instanceof ValueInterface) {
43
+        if (!$filter->value instanceof ValueInterface){
44 44
             // constant value
45 45
             return $filter;
46 46
         }
47 47
 
48
-        if (!$filter->value->accepts($value)) {
48
+        if (!$filter->value->accepts($value)){
49 49
             // invalid value
50 50
             return null;
51 51
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,14 @@
 block discarded – undo
40 40
     public function withValue($value): ?SpecificationInterface
41 41
     {
42 42
         $filter = clone $this;
43
-        if (!$filter->value instanceof ValueInterface) {
43
+        if (!$filter->value instanceof ValueInterface)
44
+        {
44 45
             // constant value
45 46
             return $filter;
46 47
         }
47 48
 
48
-        if (!$filter->value->accepts($value)) {
49
+        if (!$filter->value->accepts($value))
50
+        {
49 51
             // invalid value
50 52
             return null;
51 53
         }
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Filter/Map.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,21 +36,21 @@
 block discarded – undo
36 36
      */
37 37
     public function withValue($value): ?SpecificationInterface
38 38
     {
39
-        if (!is_array($value)) {
39
+        if (!is_array($value)){
40 40
             // only array values are expected
41 41
             return null;
42 42
         }
43 43
 
44 44
         $map = $this->clone($value);
45
-        foreach ($this->filters as $name => $filter) {
45
+        foreach ($this->filters as $name => $filter){
46 46
             $name = (string)$name;
47
-            if (!hasKey($value, $name)) {
47
+            if (!hasKey($value, $name)){
48 48
                 // all values must be provided
49 49
                 return null;
50 50
             }
51 51
 
52 52
             $applied = $filter->withValue($value[$name]);
53
-            if ($applied === null) {
53
+            if ($applied === null){
54 54
                 return null;
55 55
             }
56 56
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,21 +36,25 @@
 block discarded – undo
36 36
      */
37 37
     public function withValue($value): ?SpecificationInterface
38 38
     {
39
-        if (!is_array($value)) {
39
+        if (!is_array($value))
40
+        {
40 41
             // only array values are expected
41 42
             return null;
42 43
         }
43 44
 
44 45
         $map = $this->clone($value);
45
-        foreach ($this->filters as $name => $filter) {
46
+        foreach ($this->filters as $name => $filter)
47
+        {
46 48
             $name = (string)$name;
47
-            if (!hasKey($value, $name)) {
49
+            if (!hasKey($value, $name))
50
+            {
48 51
                 // all values must be provided
49 52
                 return null;
50 53
             }
51 54
 
52 55
             $applied = $filter->withValue($value[$name]);
53
-            if ($applied === null) {
56
+            if ($applied === null)
57
+            {
54 58
                 return null;
55 59
             }
56 60
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/NumericValue.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      */
32 32
     public function convert($value)
33 33
     {
34
-        if (is_numeric($value)) {
34
+        if (is_numeric($value)){
35 35
             return $value + 0;
36 36
         }
37 37
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
      */
32 32
     public function convert($value)
33 33
     {
34
-        if (is_numeric($value)) {
34
+        if (is_numeric($value))
35
+        {
35 36
             return $value + 0;
36 37
         }
37 38
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/DatetimeValue.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
      */
33 33
     public function convert($value): ?DateTimeImmutable
34 34
     {
35
-        try {
35
+        try{
36 36
             $value = (string)$value;
37 37
 
38 38
             return new DateTimeImmutable(is_numeric($value) ? "@$value" : $value);
39
-        } catch (Throwable $e) {
39
+        }catch (Throwable $e){
40 40
             return null;
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,14 @@
 block discarded – undo
32 32
      */
33 33
     public function convert($value): ?DateTimeImmutable
34 34
     {
35
-        try {
35
+        try
36
+        {
36 37
             $value = (string)$value;
37 38
 
38 39
             return new DateTimeImmutable(is_numeric($value) ? "@$value" : $value);
39
-        } catch (Throwable $e) {
40
+        }
41
+        catch (Throwable $e)
42
+        {
40 43
             return null;
41 44
         }
42 45
     }
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/BoolValue.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function accepts($value): bool
25 25
     {
26
-        if (is_bool($value)) {
26
+        if (is_bool($value)){
27 27
             return true;
28 28
         }
29 29
 
30
-        if (is_scalar($value)) {
30
+        if (is_scalar($value)){
31 31
             return in_array(strtolower((string)$value), ['0', '1', 'true', 'false'], true);
32 32
         }
33 33
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function convert($value): bool
42 42
     {
43
-        if (is_bool($value)) {
43
+        if (is_bool($value)){
44 44
             return $value;
45 45
         }
46 46
 
47
-        if (is_scalar($value)) {
48
-            switch (strtolower((string)$value)) {
47
+        if (is_scalar($value)){
48
+            switch (strtolower((string)$value)){
49 49
                 case '0':
50 50
                 case 'false':
51 51
                     return false;
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,11 +23,13 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function accepts($value): bool
25 25
     {
26
-        if (is_bool($value)) {
26
+        if (is_bool($value))
27
+        {
27 28
             return true;
28 29
         }
29 30
 
30
-        if (is_scalar($value)) {
31
+        if (is_scalar($value))
32
+        {
31 33
             return in_array(strtolower((string)$value), ['0', '1', 'true', 'false'], true);
32 34
         }
33 35
 
@@ -40,12 +42,15 @@  discard block
 block discarded – undo
40 42
      */
41 43
     public function convert($value): bool
42 44
     {
43
-        if (is_bool($value)) {
45
+        if (is_bool($value))
46
+        {
44 47
             return $value;
45 48
         }
46 49
 
47
-        if (is_scalar($value)) {
48
-            switch (strtolower((string)$value)) {
50
+        if (is_scalar($value))
51
+        {
52
+            switch (strtolower((string)$value))
53
+            {
49 54
                 case '0':
50 55
                 case 'false':
51 56
                     return false;
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/UuidValue.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $this->mask = strtolower($mask);
63 63
 
64
-        if ($this->mask !== self::NIL && !isset(self::PATTERNS[$this->mask])) {
64
+        if ($this->mask !== self::NIL && !isset(self::PATTERNS[$this->mask])){
65 65
             throw new ValueException('Invalid UUID version mask given. Please choose one of the constants.');
66 66
         }
67 67
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $uuid = str_replace(['urn:', 'uuid:', '{', '}'], '', $value);
95 95
 
96
-        if ($this->mask === self::NIL) {
96
+        if ($this->mask === self::NIL){
97 97
             return $value === self::NIL_VALUE;
98 98
         }
99 99
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,8 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $this->mask = strtolower($mask);
63 63
 
64
-        if ($this->mask !== self::NIL && !isset(self::PATTERNS[$this->mask])) {
64
+        if ($this->mask !== self::NIL && !isset(self::PATTERNS[$this->mask]))
65
+        {
65 66
             throw new ValueException('Invalid UUID version mask given. Please choose one of the constants.');
66 67
         }
67 68
 
@@ -93,7 +94,8 @@  discard block
 block discarded – undo
93 94
     {
94 95
         $uuid = str_replace(['urn:', 'uuid:', '{', '}'], '', $value);
95 96
 
96
-        if ($this->mask === self::NIL) {
97
+        if ($this->mask === self::NIL)
98
+        {
97 99
             return $value === self::NIL_VALUE;
98 100
         }
99 101
 
Please login to merge, or discard this patch.