@@ -170,8 +170,7 @@ |
||
| 170 | 170 | } catch (ValidateItemsError $e) { |
| 171 | 171 | if(isset($e->error['suberrors'])) { |
| 172 | 172 | $err = $e->error; |
| 173 | - } |
|
| 174 | - else { |
|
| 173 | + } else { |
|
| 175 | 174 | $err = [ |
| 176 | 175 | 'error' => $e->error, |
| 177 | 176 | ]; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if ($arr === []) { |
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | - return array_keys($arr) !== range(0, count($arr) - 1); |
|
| 96 | + return array_keys($arr) !== range(0, count($arr)-1); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | $newPath[] = 0; |
| 112 | 112 | $this->_validateItems($config, $subValue, $newPath, $validate); |
| 113 | 113 | } else { |
| 114 | - $path[count($path) - 1] = $idx; |
|
| 114 | + $path[count($path)-1] = $idx; |
|
| 115 | 115 | $err = $validate($subValue); |
| 116 | 116 | |
| 117 | - if(empty($err)) { |
|
| 117 | + if (empty($err)) { |
|
| 118 | 118 | $wrappedType = $config['type']->getWrappedType(true); |
| 119 | 119 | $err = $this->_validate([ |
| 120 | 120 | 'type' => $wrappedType |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | try { |
| 169 | 169 | $this->_validateItems($config, $value, [0], $config['validate']); |
| 170 | 170 | } catch (ValidateItemsError $e) { |
| 171 | - if(isset($e->error['suberrors'])) { |
|
| 171 | + if (isset($e->error['suberrors'])) { |
|
| 172 | 172 | $err = $e->error; |
| 173 | 173 | } |
| 174 | 174 | else { |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $fields = $type->getFields(); |
| 203 | 203 | if (is_array($value)) { |
| 204 | 204 | foreach ($value as $key => $subValue) { |
| 205 | - $config = $fields[$key]->config; |
|
| 205 | + $config = $fields[$key]->config; |
|
| 206 | 206 | $error = $this->_validate($config, $subValue); |
| 207 | 207 | |
| 208 | - if($error) { |
|
| 208 | + if ($error) { |
|
| 209 | 209 | $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error; |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $fields = []; |
| 71 | 71 | foreach ($type->getFields() as $key => $field) { |
| 72 | 72 | $fieldType = $this->_getType($field->config); |
| 73 | - if($newType = static::create( |
|
| 73 | + if ($newType = static::create( |
|
| 74 | 74 | [ |
| 75 | 75 | 'validate' => $field->config['validate'] ?? null, |
| 76 | 76 | 'errorCodes' => $field->config['errorCodes'] ?? null, |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return $userErrorType; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if(count($path) == 1) { |
|
| 194 | + if (count($path) == 1) { |
|
| 195 | 195 | throw new Exception("You must specify at least one 'validate' callback somewhere"); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -107,8 +107,7 @@ |
||
| 107 | 107 | return $value[static::SUBERRORS_NAME] ?? null; |
| 108 | 108 | }, |
| 109 | 109 | ]; |
| 110 | - } |
|
| 111 | - else { |
|
| 110 | + } else { |
|
| 112 | 111 | $finalFields += $fields; |
| 113 | 112 | } |
| 114 | 113 | } |