public function setErrors(array $errors, string $key = null, string $group = null): self
    {
        if (!empty($group)) {
            if (!empty($key)) {
                $this->errors[$group][$key] = $errors;
            } else {
                $this->errors[$group] = $errors;
            }
        } elseif (!empty($key)) {
            $this->errors[$key] = $errors;
        } else {
            $this->errors = $errors;
        }

        return $this;
    }
public function setErrors(array $errors, string $key = null, string $group = null): self
    {
        if (!empty($group)) {
            if (!empty($key)) {
                $this->errors[$group][$key] = $errors;
            } else {
                $this->errors[$group] = $errors;
            }
        } elseif (!empty($key)) {
            $this->errors[$key] = $errors;
        } else {
            $this->errors = $errors;
        }

        return $this;
    }
public function setErrors ( array $ errors , string $ key = null , string $ group = null ) : self { if ( ! empty ( $ group ) ) { if ( ! empty ( $ key ) ) { $ this -> errors [ $ group ] [ $ key ] = $ errors ; } else { $ this -> errors [ $ group ] = $ errors ; } } elseif ( ! empty ( $ key ) ) { $ this -> errors [ $ key ] = $ errors ; } else { $ this -> errors = $ errors ; } return $ this ; }
Sets validation errors.

@param string[]    $errors
@param string|null $key
@param string|null $group

@return self
Sets validation errors .