@@ -191,7 +191,7 @@ |
||
| 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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->resultFieldName = $config['resultName'] ?? 'result'; |
| 36 | 36 | |
| 37 | 37 | parent::__construct([ |
| 38 | - 'type' => function() use($name, $config, $args) { |
|
| 38 | + 'type' => function () use($name, $config, $args) { |
|
| 39 | 39 | return static::_create($name, $args, $config); |
| 40 | 40 | }, |
| 41 | 41 | 'args' => $args, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if ($arr === []) { |
| 104 | 104 | return false; |
| 105 | 105 | } |
| 106 | - return array_keys($arr) !== range(0, count($arr) - 1); |
|
| 106 | + return array_keys($arr) !== range(0, count($arr)-1); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | $path[count($path)-1] = $idx; |
| 120 | 120 | $newPath = $path; |
| 121 | 121 | $newPath[] = 0; |
| 122 | - $this->_validateItems($config, $subValue, $newPath, $validate ); |
|
| 122 | + $this->_validateItems($config, $subValue, $newPath, $validate); |
|
| 123 | 123 | } else { |
| 124 | - $path[count($path) - 1] = $idx; |
|
| 124 | + $path[count($path)-1] = $idx; |
|
| 125 | 125 | $err = $validate($subValue); |
| 126 | 126 | |
| 127 | - if(empty($err)) { |
|
| 127 | + if (empty($err)) { |
|
| 128 | 128 | $wrappedType = $config['type']->getWrappedType(true); |
| 129 | 129 | $err = $this->_validate([ |
| 130 | 130 | 'type' => $wrappedType |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | try { |
| 176 | 176 | $this->_validateItems($config, $value, [0], $config['validate'] ?? [$this, "_noop"]); |
| 177 | 177 | } catch (ValidateItemsError $e) { |
| 178 | - if(isset($e->error['suberrors'])) { |
|
| 178 | + if (isset($e->error['suberrors'])) { |
|
| 179 | 179 | $err = $e->error; |
| 180 | 180 | } |
| 181 | 181 | else { |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | $fields = $type->getFields(); |
| 208 | 208 | if (is_array($value)) { |
| 209 | 209 | foreach ($value as $key => $subValue) { |
| 210 | - $config = $fields[$key]->config; |
|
| 210 | + $config = $fields[$key]->config; |
|
| 211 | 211 | $error = $this->_validate($config, $subValue); |
| 212 | 212 | |
| 213 | - if($error) { |
|
| 213 | + if ($error) { |
|
| 214 | 214 | $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error; |
| 215 | 215 | } |
| 216 | 216 | } |