public function hasCode($code)
    {
        if ($this->getException() !== null && $this->getException()->getCode() === $code) {
            return true;
        }

        foreach ($this->getErrors() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        foreach ($this->getWarnings() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        foreach ($this->getNotices() as $message) {
            if ($message['code'] == $code) {
                return true;
            }
        }

        return false;
    }