Definition at line 8 of file Parser.php.
◆ __construct()
Definition at line 33 of file Parser.php.
35 $this->_dom = new \DOMDocument();
◆ _getCurrentDom()
- Returns
- \DOMDocument
Definition at line 61 of file Parser.php.
◆ _setCurrentDom()
- Parameters
-
- Returns
- $this
Definition at line 70 of file Parser.php.
72 $this->_currentDom = $node;
◆ _xmlToArray()
_xmlToArray |
( |
|
$currentNode = false | ) |
|
|
protected |
- Parameters
-
- Returns
- array @SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)
Definition at line 91 of file Parser.php.
94 $currentNode = $this->
getDom();
97 foreach ($currentNode->childNodes as $node) {
98 switch ($node->nodeType) {
99 case XML_ELEMENT_NODE:
103 if ($node->hasChildNodes()) {
107 if ($node->hasAttributes()) {
113 if (isset(
$content[$node->nodeName])) {
114 if ((is_string(
$content[$node->nodeName]) || !isset(
$content[$node->nodeName][0]))
117 $oldValue =
$content[$node->nodeName];
119 $content[$node->nodeName][] = $oldValue;
126 case XML_CDATA_SECTION_NODE:
130 if (trim($node->nodeValue) !==
'') {
_xmlToArray($currentNode=false)
◆ errorHandler()
errorHandler |
( |
|
$errorNo, |
|
|
|
$errorStr, |
|
|
|
$errorFile, |
|
|
|
$errorLine |
|
) |
| |
Custom XML lib error handler
- Parameters
-
int | $errorNo | |
string | $errorStr | |
string | $errorFile | |
int | $errorLine | |
- Exceptions
-
Definition at line 187 of file Parser.php.
190 $message =
"{$errorStr} in {$errorFile} on line {$errorLine}";
191 throw new \Magento\Framework\Exception\LocalizedException(
new \
Magento\Framework\Phrase(
$message));
◆ getDom()
- Returns
- \DOMDocument|null
Definition at line 53 of file Parser.php.
◆ initErrorHandler()
Initializes error handler
- Returns
- void
Definition at line 45 of file Parser.php.
47 $this->errorHandlerIsActive =
true;
◆ load()
- Parameters
-
- Returns
- $this
Definition at line 143 of file Parser.php.
145 $this->
getDom()->load($file);
◆ loadXML()
- Parameters
-
- Returns
- $this
- Exceptions
-
Definition at line 154 of file Parser.php.
156 if ($this->errorHandlerIsActive) {
157 set_error_handler([$this,
'errorHandler']);
161 $this->
getDom()->loadXML($string);
162 }
catch (\
Magento\Framework\Exception\LocalizedException $e) {
163 restore_error_handler();
164 throw new \Magento\Framework\Exception\LocalizedException(
165 new \
Magento\Framework\Phrase($e->getMessage()),
170 if ($this->errorHandlerIsActive) {
171 restore_error_handler();
◆ xmlToArray()
- Returns
- array
Definition at line 79 of file Parser.php.
_xmlToArray($currentNode=false)
◆ $_content
◆ $_currentDom
◆ $_dom
◆ $errorHandlerIsActive
$errorHandlerIsActive = false |
|
protected |
The documentation for this class was generated from the following file: