protected static function export($dom = null) {
		if (!is_a($dom, 'DOMDocument')) {
			return false;
		}

		try {
			$svgs = $dom->getElementsByTagName('svg');
			if (!$svgs->length) {
				return false;
			}
			$svg = $svgs->item(0)->ownerDocument->saveXML($svgs->item(0), LIBXML_NOBLANKS);

			// Remove comments.
			$svg = static::strip_comments($svg);

			return $svg;
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
protected static function export($dom = null) {
		if (!is_a($dom, 'DOMDocument')) {
			return false;
		}

		try {
			$svgs = $dom->getElementsByTagName('svg');
			if (!$svgs->length) {
				return false;
			}
			$svg = $svgs->item(0)->ownerDocument->saveXML($svgs->item(0), LIBXML_NOBLANKS);

			// Remove comments.
			$svg = static::strip_comments($svg);

			return $svg;
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
protected static function export ( $ dom = null ) { if ( ! is_a ( $ dom , 'DOMDocument' ) ) { return false ; } try { $ svgs = $ dom -> getElementsByTagName ( 'svg' ) ; if ( ! $ svgs -> length ) { return false ; } $ svg = $ svgs -> item ( 0 ) -> ownerDocument -> saveXML ( $ svgs -> item ( 0 ) , LIBXML_NOBLANKS ) ; // Remove comments. $ svg = static :: strip_comments ( $ svg ) ; return $ svg ; } catch ( \ Throwable $ e ) { error_log ( $ e -> getMessage ( ) ) ; return false ; } catch ( \ Exception $ e ) { return false ; } return false ; }
Export from a DOMDocument object.

@param DOMDocument $dom XML object.
@return string|bool Sanitized SVG code. False on failure.
Export from a DOMDocument object .