浏览代码

Update Core\Validator

Change getErrors() method
Visman 4 年之前
父节点
当前提交
796a2a4db1
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      app/Core/Validator.php

+ 11 - 2
app/Core/Validator.php

@@ -429,9 +429,18 @@ class Validator
     /**
     /**
      * Возращает массив ошибок
      * Возращает массив ошибок
      */
      */
-    public function getErrors(): array
+    public function getErrors(bool $withoutType = false): array
     {
     {
-        return $this->errors;
+        if ($withoutType) {
+            $result = [];
+            \array_walk_recursive($this->errors, function ($item) use (&$result) {
+                $result[] = $item;
+            });
+
+            return $result;
+        } else {
+            return $this->errors;
+        }
     }
     }
 
 
     /**
     /**