public function __construct($xml = null) { if ($xml instanceof DOMDocument) { $this->xml = $xml; } else { $this->xml = new DOMDocument(); $this->xml->loadXML($xml === null ? self::EMPTY_VALUE : $xml); } }