[\XML_PI_NODE, \XML_COMMENT_NODE], // Use the XML root node or its children as the first level of the PHP array. self::INCLUDE_ROOT_NODE => false, // Apply these libxml2 options when loading the XML. self::LOAD_OPTIONS => \LIBXML_NONET | \LIBXML_NOBLANKS, // Remove this XML namespace from each XML node, for example "T3:". self::NAMESPACE_PREFIX => '', // Gracefully handle missing namespace declarations, for example without xmlns attribute. self::ALLOW_UNDEFINED_NAMESPACES => false, // Append the name of the XML root node to the PHP array key "_DOCUMENT_TAG". self::RETURN_ROOT_NODE_NAME => false, ]; public function __construct(array $options = []) { $this->options = array_merge($this->options, $options); } public function getLoadOptions(): int { return $this->options[self::LOAD_OPTIONS]; } public function getIgnoredNodeTypes(): array { return $this->options[self::IGNORED_NODE_TYPES]; } public function includeRootNode(): bool { return $this->options[self::INCLUDE_ROOT_NODE]; } public function hasNamespacePrefix(): bool { return $this->options[self::NAMESPACE_PREFIX] !== ''; } public function getNamespacePrefix(): string { return $this->options[self::NAMESPACE_PREFIX]; } public function allowUndefinedNamespaces(): bool { return $this->options[self::ALLOW_UNDEFINED_NAMESPACES]; } public function returnRootNodeName(): bool { return $this->options[self::RETURN_ROOT_NODE_NAME]; } }