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;
    }