@@ -54,8 +54,8 @@ |
||
| 54 | 54 | protected function _getType($config) { |
| 55 | 55 | $type = $config['type']; |
| 56 | 56 | if (is_callable($type)) { |
| 57 | - $type = $type(); |
|
| 58 | - } |
|
| 57 | + $type = $type(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | if ($type instanceof WrappingType) { |
| 61 | 61 | $type = $type->getInnermostType(); |
@@ -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']->getInnermostType(); |
| 129 | 129 | $err = $this->_validate([ |
| 130 | 130 | 'type' => $wrappedType |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $res = []; |
| 149 | 149 | |
| 150 | 150 | if (is_callable($arg['type'])) { |
| 151 | - $arg['type'] = $arg['type'](); |
|
| 151 | + $arg['type'] = $arg['type'](); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $type = $arg['type']; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | try { |
| 180 | 180 | $this->_validateItems($config, $value, [0], $config['validate'] ?? [$this, "_noop"]); |
| 181 | 181 | } catch (ValidateItemsError $e) { |
| 182 | - if(isset($e->error['suberrors'])) { |
|
| 182 | + if (isset($e->error['suberrors'])) { |
|
| 183 | 183 | $err = $e->error; |
| 184 | 184 | } |
| 185 | 185 | else { |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | $fields = $type->getFields(); |
| 212 | 212 | if (is_array($value)) { |
| 213 | 213 | foreach ($value as $key => $subValue) { |
| 214 | - $config = $fields[$key]->config; |
|
| 214 | + $config = $fields[$key]->config; |
|
| 215 | 215 | $error = $this->_validate($config, $subValue); |
| 216 | 216 | |
| 217 | - if($error) { |
|
| 217 | + if ($error) { |
|
| 218 | 218 | $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error; |
| 219 | 219 | } |
| 220 | 220 | } |