self::FORMAT_PRETTY_WITH_TAB, // This XML namespace is prepended to each XML node, for example "T3:". self::NAMESPACE_PREFIX => '', // Wrap the XML with a root node of that name or set it to '' to skip wrapping. self::ROOT_NODE_NAME => 'phparray', ]; public function __construct(array $options = []) { $this->options = array_merge($this->options, $options); } public function getRootNodeName(): string { return $this->options[self::ROOT_NODE_NAME]; } public function getNewlineChar(): string { return $this->options[self::FORMAT] === self::FORMAT_INLINE ? '' : LF; } public function getIndentationStep(): string { return match ($this->options[self::FORMAT]) { self::FORMAT_INLINE => '', self::FORMAT_PRETTY_WITH_TAB => "\t", default => str_repeat(' ', max(0, $this->options[self::FORMAT])), }; } public function getNamespacePrefix(): string { return $this->options[self::NAMESPACE_PREFIX]; } }