public function getErrors($name = null)
    {
        if ($name === null) {
            return $this->errors;
        }

        $ret = [];
        foreach ($this->errors as $error) {
            if ($error->getName() === $name) {
                $ret[] = $error;
            }
        }
        return $ret;
    }
public function getErrors($name = null)
    {
        if ($name === null) {
            return $this->errors;
        }

        $ret = [];
        foreach ($this->errors as $error) {
            if ($error->getName() === $name) {
                $ret[] = $error;
            }
        }
        return $ret;
    }
public function getErrors ( $ name = null ) { if ( $ name === null ) { return $ this -> errors ; } $ ret = [ ] ; foreach ( $ this -> errors as $ error ) { if ( $ error -> getName ( ) === $ name ) { $ ret [ ] = $ error ; } } return $ ret ; }
Get validation errors for one or all fields

@param string|null $name The name of a field to get validation errors for
@return array<\sndsgd\field\Error>
Get validation errors for one or all fields