Passed
Push — master ( f49651...335469 )
by Kirill
03:32
created
src/Validation/src/RuleParser.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $rules = is_array($rules) ? $rules : [$rules];
31 31
 
32
-        foreach ($rules as $rule) {
33
-            if ($rule instanceof \Closure) {
32
+        foreach ($rules as $rule){
33
+            if ($rule instanceof \Closure){
34 34
                 yield null => $rule;
35 35
                 continue;
36 36
             }
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function parseCheck($chunk)
46 46
     {
47
-        if (is_string($chunk)) {
47
+        if (is_string($chunk)){
48 48
             $function = str_replace('::', ':', $chunk);
49
-        } else {
50
-            if (!is_array($chunk) || !isset($chunk[0])) {
49
+        }else{
50
+            if (!is_array($chunk) || !isset($chunk[0])){
51 51
                 throw new ParserException('Validation rule does not define any check.');
52 52
             }
53 53
 
54 54
             $function = $chunk[0];
55 55
         }
56 56
 
57
-        if (is_string($function)) {
57
+        if (is_string($function)){
58 58
             return str_replace('::', ':', $function);
59 59
         }
60 60
 
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function parseArgs($chunk): array
68 68
     {
69
-        if (!is_array($chunk)) {
69
+        if (!is_array($chunk)){
70 70
             return [];
71 71
         }
72 72
 
73
-        foreach (self::ARGUMENTS as $index) {
74
-            if (isset($chunk[$index])) {
73
+        foreach (self::ARGUMENTS as $index){
74
+            if (isset($chunk[$index])){
75 75
                 return $chunk[$index];
76 76
             }
77 77
         }
78 78
 
79 79
         unset($chunk[0]);
80
-        foreach (array_merge(self::MESSAGES, self::CONDITIONS) as $index) {
80
+        foreach (array_merge(self::MESSAGES, self::CONDITIONS) as $index){
81 81
             unset($chunk[$index]);
82 82
         }
83 83
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function parseMessage($chunk): ?string
91 91
     {
92
-        if (!is_array($chunk)) {
92
+        if (!is_array($chunk)){
93 93
             return null;
94 94
         }
95 95
 
96
-        foreach (self::MESSAGES as $index) {
97
-            if (isset($chunk[$index])) {
96
+        foreach (self::MESSAGES as $index){
97
+            if (isset($chunk[$index])){
98 98
                 return $chunk[$index];
99 99
             }
100 100
         }
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function parseConditions($chunk): array
109 109
     {
110
-        foreach (self::CONDITIONS as $index) {
111
-            if (isset($chunk[$index])) {
110
+        foreach (self::CONDITIONS as $index){
111
+            if (isset($chunk[$index])){
112 112
                 $conditions = [];
113
-                foreach ((array)$chunk[$index] as $key => $value) {
114
-                    if (is_numeric($key)) {
113
+                foreach ((array)$chunk[$index] as $key => $value){
114
+                    if (is_numeric($key)){
115 115
                         $conditions[$value] = [];
116
-                    } else {
116
+                    }else{
117 117
                         $conditions[$key] = (array)$value;
118 118
                     }
119 119
                 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,8 +29,10 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $rules = is_array($rules) ? $rules : [$rules];
31 31
 
32
-        foreach ($rules as $rule) {
33
-            if ($rule instanceof \Closure) {
32
+        foreach ($rules as $rule)
33
+        {
34
+            if ($rule instanceof \Closure)
35
+            {
34 36
                 yield null => $rule;
35 37
                 continue;
36 38
             }
@@ -44,17 +46,22 @@  discard block
 block discarded – undo
44 46
      */
45 47
     public function parseCheck($chunk)
46 48
     {
47
-        if (is_string($chunk)) {
49
+        if (is_string($chunk))
50
+        {
48 51
             $function = str_replace('::', ':', $chunk);
49
-        } else {
50
-            if (!is_array($chunk) || !isset($chunk[0])) {
52
+        }
53
+        else
54
+        {
55
+            if (!is_array($chunk) || !isset($chunk[0]))
56
+            {
51 57
                 throw new ParserException('Validation rule does not define any check.');
52 58
             }
53 59
 
54 60
             $function = $chunk[0];
55 61
         }
56 62
 
57
-        if (is_string($function)) {
63
+        if (is_string($function))
64
+        {
58 65
             return str_replace('::', ':', $function);
59 66
         }
60 67
 
@@ -66,18 +73,22 @@  discard block
 block discarded – undo
66 73
      */
67 74
     public function parseArgs($chunk): array
68 75
     {
69
-        if (!is_array($chunk)) {
76
+        if (!is_array($chunk))
77
+        {
70 78
             return [];
71 79
         }
72 80
 
73
-        foreach (self::ARGUMENTS as $index) {
74
-            if (isset($chunk[$index])) {
81
+        foreach (self::ARGUMENTS as $index)
82
+        {
83
+            if (isset($chunk[$index]))
84
+            {
75 85
                 return $chunk[$index];
76 86
             }
77 87
         }
78 88
 
79 89
         unset($chunk[0]);
80
-        foreach (array_merge(self::MESSAGES, self::CONDITIONS) as $index) {
90
+        foreach (array_merge(self::MESSAGES, self::CONDITIONS) as $index)
91
+        {
81 92
             unset($chunk[$index]);
82 93
         }
83 94
 
@@ -89,12 +100,15 @@  discard block
 block discarded – undo
89 100
      */
90 101
     public function parseMessage($chunk): ?string
91 102
     {
92
-        if (!is_array($chunk)) {
103
+        if (!is_array($chunk))
104
+        {
93 105
             return null;
94 106
         }
95 107
 
96
-        foreach (self::MESSAGES as $index) {
97
-            if (isset($chunk[$index])) {
108
+        foreach (self::MESSAGES as $index)
109
+        {
110
+            if (isset($chunk[$index]))
111
+            {
98 112
                 return $chunk[$index];
99 113
             }
100 114
         }
@@ -107,13 +121,19 @@  discard block
 block discarded – undo
107 121
      */
108 122
     public function parseConditions($chunk): array
109 123
     {
110
-        foreach (self::CONDITIONS as $index) {
111
-            if (isset($chunk[$index])) {
124
+        foreach (self::CONDITIONS as $index)
125
+        {
126
+            if (isset($chunk[$index]))
127
+            {
112 128
                 $conditions = [];
113
-                foreach ((array)$chunk[$index] as $key => $value) {
114
-                    if (is_numeric($key)) {
129
+                foreach ((array)$chunk[$index] as $key => $value)
130
+                {
131
+                    if (is_numeric($key))
132
+                    {
115 133
                         $conditions[$value] = [];
116
-                    } else {
134
+                    }
135
+                    else
136
+                    {
117 137
                         $conditions[$key] = (array)$value;
118 138
                     }
119 139
                 }
Please login to merge, or discard this patch.
src/Validation/src/CheckerRule.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         string $method,
39 39
         array $args = [],
40 40
         ?string $message = null
41
-    ) {
41
+    ){
42 42
         $this->checker = $checker;
43 43
         $this->method = $method;
44 44
         $this->args = $args;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function getMessage(string $field, $value): string
68 68
     {
69
-        if (!empty($this->message)) {
69
+        if (!empty($this->message)){
70 70
             return Translator::interpolate(
71 71
                 $this->message,
72 72
                 array_merge([$value, $field], $this->args)
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@
 block discarded – undo
66 66
      */
67 67
     public function getMessage(string $field, $value): string
68 68
     {
69
-        if (!empty($this->message)) {
69
+        if (!empty($this->message))
70
+        {
70 71
             return Translator::interpolate(
71 72
                 $this->message,
72 73
                 array_merge([$value, $field], $this->args)
Please login to merge, or discard this patch.
src/Validation/src/Condition/WithoutAnyCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option){
31
+            if (empty($validator->getValue($option))){
32 32
                 return true;
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option)
31
+        {
32
+            if (empty($validator->getValue($option)))
33
+            {
32 34
                 return true;
33 35
             }
34 36
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/NoneOfCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
      */
33 33
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
34 34
     {
35
-        foreach ($this->compositor->makeConditions($field, $this->options) as $condition) {
36
-            if ($condition->isMet($validator, $field, $value)) {
35
+        foreach ($this->compositor->makeConditions($field, $this->options) as $condition){
36
+            if ($condition->isMet($validator, $field, $value)){
37 37
                 return false;
38 38
             }
39 39
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,10 @@
 block discarded – undo
32 32
      */
33 33
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
34 34
     {
35
-        foreach ($this->compositor->makeConditions($field, $this->options) as $condition) {
36
-            if ($condition->isMet($validator, $field, $value)) {
35
+        foreach ($this->compositor->makeConditions($field, $this->options) as $condition)
36
+        {
37
+            if ($condition->isMet($validator, $field, $value))
38
+            {
37 39
                 return false;
38 40
             }
39 41
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/WithoutAllCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option){
31
+            if (!empty($validator->getValue($option))){
32 32
                 return false;
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option)
31
+        {
32
+            if (!empty($validator->getValue($option)))
33
+            {
32 34
                 return false;
33 35
             }
34 36
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/WithAllCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option){
31
+            if (empty($validator->getValue($option))){
32 32
                 return false;
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option)
31
+        {
32
+            if (empty($validator->getValue($option)))
33
+            {
32 34
                 return false;
33 35
             }
34 36
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/PresentCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!$validator->hasValue($option)) {
30
+        foreach ($this->options as $option){
31
+            if (!$validator->hasValue($option)){
32 32
                 return false;
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!$validator->hasValue($option)) {
30
+        foreach ($this->options as $option)
31
+        {
32
+            if (!$validator->hasValue($option))
33
+            {
32 34
                 return false;
33 35
             }
34 36
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/AnyOfCondition.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
      */
33 33
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
34 34
     {
35
-        if (empty($this->options)) {
35
+        if (empty($this->options)){
36 36
             return true;
37 37
         }
38 38
 
39
-        foreach ($this->compositor->makeConditions($field, $this->options) as $condition) {
40
-            if ($condition->isMet($validator, $field, $value)) {
39
+        foreach ($this->compositor->makeConditions($field, $this->options) as $condition){
40
+            if ($condition->isMet($validator, $field, $value)){
41 41
                 return true;
42 42
             }
43 43
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,12 +32,15 @@
 block discarded – undo
32 32
      */
33 33
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
34 34
     {
35
-        if (empty($this->options)) {
35
+        if (empty($this->options))
36
+        {
36 37
             return true;
37 38
         }
38 39
 
39
-        foreach ($this->compositor->makeConditions($field, $this->options) as $condition) {
40
-            if ($condition->isMet($validator, $field, $value)) {
40
+        foreach ($this->compositor->makeConditions($field, $this->options) as $condition)
41
+        {
42
+            if ($condition->isMet($validator, $field, $value))
43
+            {
41 44
                 return true;
42 45
             }
43 46
         }
Please login to merge, or discard this patch.
src/Validation/src/Condition/WithAnyCondition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option){
31
+            if (!empty($validator->getValue($option))){
32 32
                 return true;
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     public function isMet(ValidatorInterface $validator, string $field, $value): bool
29 29
     {
30
-        foreach ($this->options as $option) {
31
-            if (!empty($validator->getValue($option))) {
30
+        foreach ($this->options as $option)
31
+        {
32
+            if (!empty($validator->getValue($option)))
33
+            {
32 34
                 return true;
33 35
             }
34 36
         }
Please login to merge, or discard this patch.