Definition at line 34 of file Xml.php.
◆ __construct()
__construct |
( |
|
$options = array() | ) |
|
Class constructor (the default encoding is UTF-8)
- Parameters
-
- Returns
- void
Definition at line 58 of file Xml.php.
63 $args = func_get_args();
66 'rootElement' => array_shift($args)
70 $options[
'elementMap'] = array_shift($args);
74 $options[
'encoding'] = array_shift($args);
78 if (!array_key_exists(
'rootElement',
$options)) {
79 $options[
'rootElement'] =
'logEntry';
82 if (!array_key_exists(
'encoding',
$options)) {
86 $this->_rootElement =
$options[
'rootElement'];
89 if (array_key_exists(
'elementMap',
$options)) {
90 $this->_elementMap =
$options[
'elementMap'];
elseif(isset( $params[ 'redirect_parent']))
◆ factory()
static factory |
( |
|
$options | ) |
|
|
static |
◆ format()
Formats data into a single line to be written by the writer.
- Parameters
-
- Returns
- string formatted line to write to the log
Implements Zend_Log_Formatter_Interface.
Definition at line 133 of file Xml.php.
135 if ($this->_elementMap ===
null) {
136 $dataToInsert = $event;
138 $dataToInsert = array();
139 foreach ($this->_elementMap as
$elementName => $fieldKey) {
145 $dom =
new DOMDocument(
'1.0', $enc);
146 $elt = $dom->appendChild(
new DOMElement($this->_rootElement));
148 foreach ($dataToInsert as $key =>
$value) {
151 || (is_object(
$value) && method_exists(
$value,
'__toString'))
153 if($key ==
"message") {
156 $elt->appendChild(
new DOMElement($key, (
string)
$value));
160 $xml = $dom->saveXML();
161 $xml = preg_replace(
'/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u',
'', $xml);
163 return $xml . PHP_EOL;
◆ getEncoding()
Get encoding
- Returns
- string
Definition at line 110 of file Xml.php.
◆ setEncoding()
◆ $_elementMap
◆ $_encoding
◆ $_rootElement
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Log/Formatter/Xml.php