public static function getInstance() { if (self::$instance === null) { self::$instance = new self(); $xmlstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors/>"; if (self::$xml === null) { self::$xml = new \SimpleXMLElement($xmlstr); self::$xml->addChild("error", "500"); self::$xml->addChild("description", "Internal Server Error"); self::$stacktraces = self::$xml->addChild("stacktraces"); } } return self::$instance; }