Passed
Pull Request — master (#656)
by Abdul Malik
18:10 queued 08:15
created
src/Validation/src/Checker/AddressChecker.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@
 block discarded – undo
51 51
     public function url(string $url, ?array $schemas = null, ?string $defaultSchema = null): bool
52 52
     {
53 53
         //Add default schema if not presented
54
-        if (!empty($defaultSchema) && !$this->hasSchema($url)) {
54
+        if (!empty($defaultSchema) && !$this->hasSchema($url)){
55 55
             $defaultSchema = $this->trimSchema($defaultSchema);
56
-            if (!empty($defaultSchema)) {
56
+            if (!empty($defaultSchema)){
57 57
                 $url = "$defaultSchema://{$this->trimURL($url)}";
58 58
             }
59 59
         }
60 60
 
61
-        if (empty($schemas)) {
61
+        if (empty($schemas)){
62 62
             return (bool)filter_var($url, FILTER_VALIDATE_URL);
63 63
         }
64 64
 
65
-        foreach ($schemas as $schema) {
65
+        foreach ($schemas as $schema){
66 66
             $schema = $this->trimSchema($schema);
67
-            if (empty($schema) || !$this->containsSchema($url, $schema)) {
67
+            if (empty($schema) || !$this->containsSchema($url, $schema)){
68 68
                 continue;
69 69
             }
70 70
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,20 +51,25 @@
 block discarded – undo
51 51
     public function url(string $url, ?array $schemas = null, ?string $defaultSchema = null): bool
52 52
     {
53 53
         //Add default schema if not presented
54
-        if (!empty($defaultSchema) && !$this->hasSchema($url)) {
54
+        if (!empty($defaultSchema) && !$this->hasSchema($url))
55
+        {
55 56
             $defaultSchema = $this->trimSchema($defaultSchema);
56
-            if (!empty($defaultSchema)) {
57
+            if (!empty($defaultSchema))
58
+            {
57 59
                 $url = "$defaultSchema://{$this->trimURL($url)}";
58 60
             }
59 61
         }
60 62
 
61
-        if (empty($schemas)) {
63
+        if (empty($schemas))
64
+        {
62 65
             return (bool)filter_var($url, FILTER_VALIDATE_URL);
63 66
         }
64 67
 
65
-        foreach ($schemas as $schema) {
68
+        foreach ($schemas as $schema)
69
+        {
66 70
             $schema = $this->trimSchema($schema);
67
-            if (empty($schema) || !$this->containsSchema($url, $schema)) {
71
+            if (empty($schema) || !$this->containsSchema($url, $schema))
72
+            {
68 73
                 continue;
69 74
             }
70 75
 
Please login to merge, or discard this patch.
src/Validation/src/Checker/MixedChecker.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function cardNumber($value): bool
38 38
     {
39
-        if (!is_string($value) || strlen($value) < 12) {
39
+        if (!is_string($value) || strlen($value) < 12){
40 40
             return false;
41 41
         }
42 42
 
43
-        if ($value !== preg_replace('/\D+/', '', $value)) {
43
+        if ($value !== preg_replace('/\D+/', '', $value)){
44 44
             return false;
45 45
         }
46 46
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $odd = strlen($value) % 2;
49 49
 
50 50
         $length = strlen($value);
51
-        for ($i = 0; $i < $length; ++$i) {
51
+        for ($i = 0; $i < $length; ++$i){
52 52
             $result += $odd
53 53
                 ? $value[$i]
54 54
                 : (($value[$i] * 2 > 9) ? $value[$i] * 2 - 9 : $value[$i] * 2);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function match($value, string $field, bool $strict = false): bool
72 72
     {
73
-        if ($strict) {
73
+        if ($strict){
74 74
             return $value === $this->getValidator()->getValue($field, null);
75 75
         }
76 76
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,13 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function cardNumber($value): bool
38 38
     {
39
-        if (!is_string($value) || strlen($value) < 12) {
39
+        if (!is_string($value) || strlen($value) < 12)
40
+        {
40 41
             return false;
41 42
         }
42 43
 
43
-        if ($value !== preg_replace('/\D+/', '', $value)) {
44
+        if ($value !== preg_replace('/\D+/', '', $value))
45
+        {
44 46
             return false;
45 47
         }
46 48
 
@@ -48,7 +50,8 @@  discard block
 block discarded – undo
48 50
         $odd = strlen($value) % 2;
49 51
 
50 52
         $length = strlen($value);
51
-        for ($i = 0; $i < $length; ++$i) {
53
+        for ($i = 0; $i < $length; ++$i)
54
+        {
52 55
             $result += $odd
53 56
                 ? $value[$i]
54 57
                 : (($value[$i] * 2 > 9) ? $value[$i] * 2 - 9 : $value[$i] * 2);
@@ -70,7 +73,8 @@  discard block
 block discarded – undo
70 73
      */
71 74
     public function match($value, string $field, bool $strict = false): bool
72 75
     {
73
-        if ($strict) {
76
+        if ($strict)
77
+        {
74 78
             return $value === $this->getValidator()->getValue($field, null);
75 79
         }
76 80
 
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.