Passed
Push — master ( 74d060...d17a79 )
by Kirill
05:31 queued 10s
created
src/Framework/Validation/Checker/EntityChecker.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
     public function exists($value, string $role, ?string $field = null, bool $ignoreCase = false): bool
43 43
     {
44 44
         $repository = $this->orm->getRepository($role);
45
-        if ($field === null) {
45
+        if ($field === null){
46 46
             return $repository->findByPK($value) !== null;
47 47
         }
48 48
 
49
-        if ($ignoreCase && is_string($value) && $repository instanceof Repository) {
49
+        if ($ignoreCase && is_string($value) && $repository instanceof Repository){
50 50
             return $this
51 51
                 ->getCaseInsensitiveSelect($repository, $field, $value)
52 52
                 ->fetchOne() !== null;
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
         $values = $this->withValues($withFields);
69 69
         $values[$field] = $value;
70 70
 
71
-        if ($this->isProvidedByContext($role, $values)) {
71
+        if ($this->isProvidedByContext($role, $values)){
72 72
             return true;
73 73
         }
74 74
 
75 75
         $repository = $this->orm->getRepository($role);
76 76
 
77
-        if ($ignoreCase && is_string($value) && $repository instanceof Repository) {
77
+        if ($ignoreCase && is_string($value) && $repository instanceof Repository){
78 78
             return $this
79 79
                 ->getCaseInsensitiveSelect($repository, $field, $value)
80 80
                 ->fetchOne() === null;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     private function withValues(array $fields): array
91 91
     {
92 92
         $values = [];
93
-        foreach ($fields as $field) {
94
-            if ($this->getValidator()->hasValue($field)) {
93
+        foreach ($fields as $field){
94
+            if ($this->getValidator()->hasValue($field)){
95 95
                 $values[$field] = $this->getValidator()->getValue($field);
96 96
             }
97 97
         }
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
     private function isProvidedByContext(string $role, array $values): bool
108 108
     {
109 109
         $entity = $this->getValidator()->getContext();
110
-        if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) {
110
+        if (!is_object($entity) || !$this->orm->getHeap()->has($entity)){
111 111
             return false;
112 112
         }
113 113
 
114 114
         $extract = $this->orm->getMapper($role)->extract($entity);
115
-        foreach ($values as $field => $value) {
116
-            if (!isset($extract[$field]) || $extract[$field] !== $value) {
115
+        foreach ($values as $field => $value){
116
+            if (!isset($extract[$field]) || $extract[$field] !== $value){
117 117
                 return false;
118 118
             }
119 119
         }
Please login to merge, or discard this patch.
tests/Framework/Validation/EntityCheckerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
             ['value' => $value] + $data,
166 166
             ['value' => [['entity::unique', User::class, $field, $fields, $ignoreCase]]]
167 167
         );
168
-        if ($context !== null) {
168
+        if ($context !== null){
169 169
             $validator = $validator->withContext($context);
170 170
         }
171 171
 
Please login to merge, or discard this patch.