Services_Hoptoad::buildXmlNotice PHP Method

buildXmlNotice() public method

Build up the XML to post according to the documentation at: http://help.hoptoadapp.com/faqs/api-2/notifier-api-v2
Author: Rich Cavanaugh
public buildXmlNotice ( ) : string
return string
    function buildXmlNotice()
    {
        $doc = new SimpleXMLElement('<notice />');
        $doc->addAttribute('version', self::NOTIFIER_API_VERSION);
        $doc->addChild('api-key', $this->apiKey);
        $notifier = $doc->addChild('notifier');
        $notifier->addChild('name', self::NOTIFIER_NAME);
        $notifier->addChild('version', self::NOTIFIER_VERSION);
        $notifier->addChild('url', self::NOTIFIER_URL);
        $error = $doc->addChild('error');
        $error->addChild('class', $this->error_class);
        $error->addChild('message', $this->message);
        $this->addXmlBacktrace($error);
        $request = $doc->addChild('request');
        $request->addChild('url', htmlspecialchars($this->request_uri()));
        $request->addChild('component', $this->component());
        $request->addChild('action', $this->action());
        if (isset($_REQUEST)) {
            $this->addXmlVars($request, 'params', $this->params());
        }
        if (isset($_SESSION)) {
            $this->addXmlVars($request, 'session', $this->session());
        }
        if (isset($_SERVER)) {
            $this->addXmlVars($request, 'cgi-data', $this->cgi_data());
        }
        $env = $doc->addChild('server-environment');
        $env->addChild('project-root', $this->project_root());
        $env->addChild('environment-name', $this->environment());
        return $doc->asXML();
    }