Passed
Push — master ( 8c2778...04210d )
by Domenico
02:17
created
src/XmlDomLoader.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -33,76 +33,76 @@  discard block
 block discarded – undo
33 33
      * @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself
34 34
      * @throws XmlParsingException When parsing of XML file returns error
35 35
      */
36
-    public static function load( $content, Config $config = null ) {
37
-        if ( !extension_loaded( 'dom' ) ) {
38
-            throw new RuntimeException( 'Extension DOM is required.' );
36
+    public static function load($content, Config $config = null) {
37
+        if (!extension_loaded('dom')) {
38
+            throw new RuntimeException('Extension DOM is required.');
39 39
         }
40 40
 
41
-        if ( is_null( $config ) ) {
41
+        if (is_null($config)) {
42 42
             $config = new Config();
43 43
         }
44 44
 
45
-        $internalErrors  = libxml_use_internal_errors( true );
45
+        $internalErrors  = libxml_use_internal_errors(true);
46 46
         $disableEntities = libxml_disable_entity_loader();
47 47
         libxml_clear_errors();
48 48
 
49
-        $dom                  = new DOMDocument( '1.0', 'UTF-8' );
49
+        $dom                  = new DOMDocument('1.0', 'UTF-8');
50 50
         $dom->validateOnParse = true;
51 51
 
52
-        if ( is_string( $config->getSetRootElement() ) && !empty( $config->getSetRootElement() ) ) {
52
+        if (is_string($config->getSetRootElement()) && !empty($config->getSetRootElement())) {
53 53
             $content = "<{$config->getSetRootElement()}>$content</{$config->getSetRootElement()}>";
54 54
         }
55 55
 
56
-        $res = $dom->loadXML( $content, $config->getXML_OPTIONS() );
56
+        $res = $dom->loadXML($content, $config->getXML_OPTIONS());
57 57
 
58
-        if ( !$res ) {
59
-            libxml_disable_entity_loader( $disableEntities );
58
+        if (!$res) {
59
+            libxml_disable_entity_loader($disableEntities);
60 60
 
61
-            throw new XmlParsingException( implode( "\n", static::getXmlErrors( $internalErrors ) ) );
61
+            throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors)));
62 62
         }
63 63
 
64 64
         $dom->normalizeDocument();
65 65
 
66
-        libxml_use_internal_errors( $internalErrors );
67
-        libxml_disable_entity_loader( $disableEntities );
66
+        libxml_use_internal_errors($internalErrors);
67
+        libxml_disable_entity_loader($disableEntities);
68 68
 
69
-        foreach ( $dom->childNodes as $child ) {
70
-            if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType && !$config->getAllowDocumentType() ) {
71
-                throw new XmlParsingException( 'Document types are not allowed.' );
69
+        foreach ($dom->childNodes as $child) {
70
+            if (XML_DOCUMENT_TYPE_NODE === $child->nodeType && !$config->getAllowDocumentType()) {
71
+                throw new XmlParsingException('Document types are not allowed.');
72 72
             }
73 73
         }
74 74
 
75
-        if ( null !== $config->getSchemaOrCallable() ) {
76
-            $internalErrors = libxml_use_internal_errors( true );
75
+        if (null !== $config->getSchemaOrCallable()) {
76
+            $internalErrors = libxml_use_internal_errors(true);
77 77
             libxml_clear_errors();
78 78
 
79 79
             $e = null;
80
-            if ( is_callable( $config->getSchemaOrCallable() ) ) {
80
+            if (is_callable($config->getSchemaOrCallable())) {
81 81
                 try {
82
-                    $valid = call_user_func( $config->getSchemaOrCallable(), $dom, $internalErrors );
83
-                } catch ( Exception $e ) {
82
+                    $valid = call_user_func($config->getSchemaOrCallable(), $dom, $internalErrors);
83
+                } catch (Exception $e) {
84 84
                     $valid = false;
85 85
                 }
86
-            } elseif ( !is_array( $config->getSchemaOrCallable() ) && is_file( (string)$config->getSchemaOrCallable() ) ) {
87
-                $schemaSource = file_get_contents( (string)$config->getSchemaOrCallable() );
88
-                $valid        = @$dom->schemaValidateSource( $schemaSource );
86
+            } elseif (!is_array($config->getSchemaOrCallable()) && is_file((string) $config->getSchemaOrCallable())) {
87
+                $schemaSource = file_get_contents((string) $config->getSchemaOrCallable());
88
+                $valid        = @$dom->schemaValidateSource($schemaSource);
89 89
             } else {
90
-                libxml_use_internal_errors( $internalErrors );
90
+                libxml_use_internal_errors($internalErrors);
91 91
 
92
-                throw new XmlParsingException( 'The schemaOrCallable argument has to be a valid path to XSD file or callable.' );
92
+                throw new XmlParsingException('The schemaOrCallable argument has to be a valid path to XSD file or callable.');
93 93
             }
94 94
 
95
-            if ( !$valid ) {
96
-                $messages = static::getXmlErrors( $internalErrors );
97
-                if ( empty( $messages ) ) {
98
-                    throw new InvalidXmlException( 'The XML is not valid.', 0, $e );
95
+            if (!$valid) {
96
+                $messages = static::getXmlErrors($internalErrors);
97
+                if (empty($messages)) {
98
+                    throw new InvalidXmlException('The XML is not valid.', 0, $e);
99 99
                 }
100
-                throw new XmlParsingException( implode( "\n", $messages ), 0, $e );
100
+                throw new XmlParsingException(implode("\n", $messages), 0, $e);
101 101
             }
102 102
         }
103 103
 
104 104
         libxml_clear_errors();
105
-        libxml_use_internal_errors( $internalErrors );
105
+        libxml_use_internal_errors($internalErrors);
106 106
 
107 107
         return $dom;
108 108
     }
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
      *
113 113
      * @return array
114 114
      */
115
-    private static function getXmlErrors( $internalErrors ) {
115
+    private static function getXmlErrors($internalErrors) {
116 116
         $errors = [];
117
-        foreach ( libxml_get_errors() as $error ) {
117
+        foreach (libxml_get_errors() as $error) {
118 118
             $errors[] = sprintf(
119 119
                     '[%s %s] %s (in %s - line %d, column %d)',
120 120
                     LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
121 121
                     $error->code,
122
-                    trim( $error->message ),
122
+                    trim($error->message),
123 123
                     $error->file ?: 'n/a',
124 124
                     $error->line,
125 125
                     $error->column
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
 
129 129
         libxml_clear_errors();
130
-        libxml_use_internal_errors( $internalErrors );
130
+        libxml_use_internal_errors($internalErrors);
131 131
 
132 132
         return $errors;
133 133
     }
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
      */
32 32
     protected $XML_OPTIONS = 0;
33 33
 
34
-    public function __construct( $setRootElement = null, $allowDocumentType = false, $XML_OPTIONS = 0, $schemaOrCallable = null ) {
35
-        $this->XML_OPTIONS       = $XML_OPTIONS | ( defined( 'LIBXML_COMPACT' ) ? LIBXML_COMPACT : 0 );
34
+    public function __construct($setRootElement = null, $allowDocumentType = false, $XML_OPTIONS = 0, $schemaOrCallable = null) {
35
+        $this->XML_OPTIONS       = $XML_OPTIONS | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0);
36 36
         $this->setRootElement    = $setRootElement;
37 37
         $this->allowDocumentType = $allowDocumentType;
38 38
         $this->schemaOrCallable  = $schemaOrCallable;
Please login to merge, or discard this patch.
src/HtmlParser.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      * @throws InvalidXmlException
30 30
      * @throws XmlParsingException
31 31
      */
32
-    public static function parse( $xml, $isXmlFragment = false ) {
33
-        $parser = new static( $xml, $isXmlFragment, true );
32
+    public static function parse($xml, $isXmlFragment = false) {
33
+        $parser = new static($xml, $isXmlFragment, true);
34 34
 
35 35
         return $parser->extractNodes();
36 36
     }
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
      */
41 41
     protected function getNodeListFromQueryPath() {
42 42
 
43
-        $xpath = new DOMXPath( $this->dom );
43
+        $xpath = new DOMXPath($this->dom);
44 44
 
45
-        if ( $this->isXmlFragment ) {
46
-            $htmlNodeList = $xpath->query( "/" . self::fragmentDocumentRoot );
45
+        if ($this->isXmlFragment) {
46
+            $htmlNodeList = $xpath->query("/".self::fragmentDocumentRoot);
47 47
         } else {
48
-            $htmlNodeList = $xpath->query( "/html" );
48
+            $htmlNodeList = $xpath->query("/html");
49 49
         }
50 50
 
51 51
         return $htmlNodeList;
Please login to merge, or discard this patch.
src/XmlParser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      * @throws InvalidXmlException
31 31
      * @throws XmlParsingException
32 32
      */
33
-    public static function parse( $xml, $isXmlFragment = false ) {
34
-        $parser = new static( $xml, $isXmlFragment );
33
+    public static function parse($xml, $isXmlFragment = false) {
34
+        $parser = new static($xml, $isXmlFragment);
35 35
 
36 36
         return $parser->extractNodes();
37 37
     }
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * @return DOMNodeList
41 41
      */
42
-    protected function getNodeListFromQueryPath(){
42
+    protected function getNodeListFromQueryPath() {
43 43
 
44
-        $xpath = new DOMXPath( $this->dom );
44
+        $xpath = new DOMXPath($this->dom);
45 45
 
46
-        if ( $this->isXmlFragment ) {
47
-            $xmlNodeList = $xpath->query( "/" . self::fragmentDocumentRoot );
46
+        if ($this->isXmlFragment) {
47
+            $xmlNodeList = $xpath->query("/".self::fragmentDocumentRoot);
48 48
         } else {
49
-            $xmlNodeList = $xpath->query( "*" );
49
+            $xmlNodeList = $xpath->query("*");
50 50
         }
51 51
 
52 52
         return $xmlNodeList;
Please login to merge, or discard this patch.
src/AbstractParser.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -25,39 +25,39 @@  discard block
 block discarded – undo
25 25
     const regexpEntity         = '/&#x([0-1]{0,1}[0-9A-F]{1,2})/u'; //&#x1E;  &#xE;
26 26
     const regexpAscii          = '/([\x{00}-\x{1F}\x{7F}]{1})/u';
27 27
     protected static $asciiPlaceHoldMap = [
28
-            '00' => [ 'symbol' => 'NULL', 'placeHold' => '', 'numeral' => 0x00 ],
29
-            '01' => [ 'symbol' => 'SOH', 'placeHold' => '', 'numeral' => 0x01 ],
30
-            '02' => [ 'symbol' => 'STX', 'placeHold' => '', 'numeral' => 0x02 ],
31
-            '03' => [ 'symbol' => 'ETX', 'placeHold' => '', 'numeral' => 0x03 ],
32
-            '04' => [ 'symbol' => 'EOT', 'placeHold' => '', 'numeral' => 0x04 ],
33
-            '05' => [ 'symbol' => 'ENQ', 'placeHold' => '', 'numeral' => 0x05 ],
34
-            '06' => [ 'symbol' => 'ACK', 'placeHold' => '', 'numeral' => 0x06 ],
35
-            '07' => [ 'symbol' => 'BEL', 'placeHold' => '', 'numeral' => 0x07 ],
36
-            '08' => [ 'symbol' => 'BS', 'placeHold' => '', 'numeral' => 0x08 ],
37
-            '09' => [ 'symbol' => 'HT', 'placeHold' => '', 'numeral' => 0x09 ],
38
-            '0A' => [ 'symbol' => 'LF', 'placeHold' => '', 'numeral' => 0x0A ],
39
-            '0B' => [ 'symbol' => 'VT', 'placeHold' => '', 'numeral' => 0x0B ],
40
-            '0C' => [ 'symbol' => 'FF', 'placeHold' => '', 'numeral' => 0x0C ],
41
-            '0D' => [ 'symbol' => 'CR', 'placeHold' => '', 'numeral' => 0x0D ],
42
-            '0E' => [ 'symbol' => 'SO', 'placeHold' => '', 'numeral' => 0x0E ],
43
-            '0F' => [ 'symbol' => 'SI', 'placeHold' => '', 'numeral' => 0x0F ],
44
-            '10' => [ 'symbol' => 'DLE', 'placeHold' => '', 'numeral' => 0x10 ],
45
-            '11' => [ 'symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x11 ],
46
-            '12' => [ 'symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x12 ],
47
-            '13' => [ 'symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x13 ],
48
-            '14' => [ 'symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x14 ],
49
-            '15' => [ 'symbol' => 'NAK', 'placeHold' => '', 'numeral' => 0x15 ],
50
-            '16' => [ 'symbol' => 'SYN', 'placeHold' => '', 'numeral' => 0x16 ],
51
-            '17' => [ 'symbol' => 'ETB', 'placeHold' => '', 'numeral' => 0x17 ],
52
-            '18' => [ 'symbol' => 'CAN', 'placeHold' => '', 'numeral' => 0x18 ],
53
-            '19' => [ 'symbol' => 'EM', 'placeHold' => '', 'numeral' => 0x19 ],
54
-            '1A' => [ 'symbol' => 'SUB', 'placeHold' => '', 'numeral' => 0x1A ],
55
-            '1B' => [ 'symbol' => 'ESC', 'placeHold' => '', 'numeral' => 0x1B ],
56
-            '1C' => [ 'symbol' => 'FS', 'placeHold' => '', 'numeral' => 0x1C ],
57
-            '1D' => [ 'symbol' => 'GS', 'placeHold' => '', 'numeral' => 0x1D ],
58
-            '1E' => [ 'symbol' => 'RS', 'placeHold' => '', 'numeral' => 0x1E ],
59
-            '1F' => [ 'symbol' => 'US', 'placeHold' => '', 'numeral' => 0x1F ],
60
-            '7F' => [ 'symbol' => 'DEL', 'placeHold' => '', 'numeral' => 0x7F ],
28
+            '00' => ['symbol' => 'NULL', 'placeHold' => '', 'numeral' => 0x00],
29
+            '01' => ['symbol' => 'SOH', 'placeHold' => '', 'numeral' => 0x01],
30
+            '02' => ['symbol' => 'STX', 'placeHold' => '', 'numeral' => 0x02],
31
+            '03' => ['symbol' => 'ETX', 'placeHold' => '', 'numeral' => 0x03],
32
+            '04' => ['symbol' => 'EOT', 'placeHold' => '', 'numeral' => 0x04],
33
+            '05' => ['symbol' => 'ENQ', 'placeHold' => '', 'numeral' => 0x05],
34
+            '06' => ['symbol' => 'ACK', 'placeHold' => '', 'numeral' => 0x06],
35
+            '07' => ['symbol' => 'BEL', 'placeHold' => '', 'numeral' => 0x07],
36
+            '08' => ['symbol' => 'BS', 'placeHold' => '', 'numeral' => 0x08],
37
+            '09' => ['symbol' => 'HT', 'placeHold' => '', 'numeral' => 0x09],
38
+            '0A' => ['symbol' => 'LF', 'placeHold' => '', 'numeral' => 0x0A],
39
+            '0B' => ['symbol' => 'VT', 'placeHold' => '', 'numeral' => 0x0B],
40
+            '0C' => ['symbol' => 'FF', 'placeHold' => '', 'numeral' => 0x0C],
41
+            '0D' => ['symbol' => 'CR', 'placeHold' => '', 'numeral' => 0x0D],
42
+            '0E' => ['symbol' => 'SO', 'placeHold' => '', 'numeral' => 0x0E],
43
+            '0F' => ['symbol' => 'SI', 'placeHold' => '', 'numeral' => 0x0F],
44
+            '10' => ['symbol' => 'DLE', 'placeHold' => '', 'numeral' => 0x10],
45
+            '11' => ['symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x11],
46
+            '12' => ['symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x12],
47
+            '13' => ['symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x13],
48
+            '14' => ['symbol' => 'DC', 'placeHold' => '', 'numeral' => 0x14],
49
+            '15' => ['symbol' => 'NAK', 'placeHold' => '', 'numeral' => 0x15],
50
+            '16' => ['symbol' => 'SYN', 'placeHold' => '', 'numeral' => 0x16],
51
+            '17' => ['symbol' => 'ETB', 'placeHold' => '', 'numeral' => 0x17],
52
+            '18' => ['symbol' => 'CAN', 'placeHold' => '', 'numeral' => 0x18],
53
+            '19' => ['symbol' => 'EM', 'placeHold' => '', 'numeral' => 0x19],
54
+            '1A' => ['symbol' => 'SUB', 'placeHold' => '', 'numeral' => 0x1A],
55
+            '1B' => ['symbol' => 'ESC', 'placeHold' => '', 'numeral' => 0x1B],
56
+            '1C' => ['symbol' => 'FS', 'placeHold' => '', 'numeral' => 0x1C],
57
+            '1D' => ['symbol' => 'GS', 'placeHold' => '', 'numeral' => 0x1D],
58
+            '1E' => ['symbol' => 'RS', 'placeHold' => '', 'numeral' => 0x1E],
59
+            '1F' => ['symbol' => 'US', 'placeHold' => '', 'numeral' => 0x1F],
60
+            '7F' => ['symbol' => 'DEL', 'placeHold' => '', 'numeral' => 0x7F],
61 61
     ];
62 62
 
63 63
     /**
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
      * @throws InvalidXmlException
77 77
      * @throws XmlParsingException
78 78
      */
79
-    protected function __construct( $xml, $isXmlFragment, $isHtml = false ) {
80
-        $xml                 = $this->removeNotPrintableChars( $xml );
79
+    protected function __construct($xml, $isXmlFragment, $isHtml = false) {
80
+        $xml                 = $this->removeNotPrintableChars($xml);
81 81
         $this->isXmlFragment = $isXmlFragment;
82 82
 
83 83
         $this->dom = XmlDomLoader::load(
84 84
                 $xml,
85 85
                 new Config(
86
-                        ( $isXmlFragment ? self::fragmentDocumentRoot : null ),
86
+                        ($isXmlFragment ? self::fragmentDocumentRoot : null),
87 87
                         $isHtml,
88 88
                         LIBXML_NONET | LIBXML_NOBLANKS
89 89
                 )
@@ -100,36 +100,36 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @return string
102 102
      */
103
-    protected function removeNotPrintableChars( $seg ) {
103
+    protected function removeNotPrintableChars($seg) {
104 104
 
105
-        preg_match_all( self::regexpAscii, $seg, $matches );
105
+        preg_match_all(self::regexpAscii, $seg, $matches);
106 106
 
107
-        if ( !empty( $matches[ 1 ] ) ) {
107
+        if (!empty($matches[1])) {
108 108
             $test_src = $seg;
109
-            foreach ( $matches[ 1 ] as $v ) {
110
-                $key      = sprintf( "%02X", ord( $v ) );
111
-                $hexNum   = sprintf( "/(\\x{%s})/u", $key );
112
-                $test_src = preg_replace( $hexNum, self::$asciiPlaceHoldMap[ $key ][ 'placeHold' ], $test_src, 1 );
109
+            foreach ($matches[1] as $v) {
110
+                $key      = sprintf("%02X", ord($v));
111
+                $hexNum   = sprintf("/(\\x{%s})/u", $key);
112
+                $test_src = preg_replace($hexNum, self::$asciiPlaceHoldMap[$key]['placeHold'], $test_src, 1);
113 113
             }
114 114
 
115 115
             $seg = $test_src;
116 116
         }
117 117
 
118
-        preg_match_all( self::regexpEntity, $seg, $matches );
118
+        preg_match_all(self::regexpEntity, $seg, $matches);
119 119
 
120
-        if ( !empty( $matches[ 1 ] ) ) {
120
+        if (!empty($matches[1])) {
121 121
             $test_src = $seg;
122
-            foreach ( $matches[ 1 ] as $v ) {
123
-                $byte = sprintf( "%02X", hexdec( $v ) );
124
-                if ( $byte[ 0 ] == '0' ) {
125
-                    $regexp = '/&#x([' . $byte[ 0 ] . ']?' . $byte[ 1 ] . ');/u';
122
+            foreach ($matches[1] as $v) {
123
+                $byte = sprintf("%02X", hexdec($v));
124
+                if ($byte[0] == '0') {
125
+                    $regexp = '/&#x(['.$byte[0].']?'.$byte[1].');/u';
126 126
                 } else {
127
-                    $regexp = '/&#x(' . $byte . ');/u';
127
+                    $regexp = '/&#x('.$byte.');/u';
128 128
                 }
129 129
 
130
-                $key = sprintf( "%02X", hexdec( $v ) );
131
-                if ( array_key_exists( $key, self::$asciiPlaceHoldMap ) ) {
132
-                    $test_src = preg_replace( $regexp, self::$asciiPlaceHoldMap[ $key ][ 'placeHold' ], $test_src );
130
+                $key = sprintf("%02X", hexdec($v));
131
+                if (array_key_exists($key, self::$asciiPlaceHoldMap)) {
132
+                    $test_src = preg_replace($regexp, self::$asciiPlaceHoldMap[$key]['placeHold'], $test_src);
133 133
                 }
134 134
 
135 135
             }
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
      *
147 147
      * @return ArrayObject
148 148
      */
149
-    protected function mapElements( DOMNodeList $elementList, ArrayObject $elements ) {
149
+    protected function mapElements(DOMNodeList $elementList, ArrayObject $elements) {
150 150
 
151
-        for ( $i = 0; $i < $elementList->length; $i++ ) {
151
+        for ($i = 0; $i < $elementList->length; $i++) {
152 152
 
153
-            $element = $elementList->item( $i );
153
+            $element = $elementList->item($i);
154 154
 
155
-            $elements[] = (object)[
156
-                    'node'         => $this->dom->saveXML( $element ),
155
+            $elements[] = (object) [
156
+                    'node'         => $this->dom->saveXML($element),
157 157
                     'tagName'      => $element->nodeName,
158
-                    'attributes'   => $this->getAttributes( $element ),
159
-                    'text'         => ( $element instanceof DOMText ) ? $element->textContent : null,
160
-                    'self_closed'  => ( $element instanceof DOMText ) ? null : !$element->hasChildNodes(),
161
-                    'has_children' => ( $element instanceof DOMText ) ? null : $element->hasChildNodes(),
162
-                    'inner_html'   => $element->hasChildNodes() ? $this->mapElements( $element->childNodes, new ArrayObject() ) : new ArrayObject()
158
+                    'attributes'   => $this->getAttributes($element),
159
+                    'text'         => ($element instanceof DOMText) ? $element->textContent : null,
160
+                    'self_closed'  => ($element instanceof DOMText) ? null : !$element->hasChildNodes(),
161
+                    'has_children' => ($element instanceof DOMText) ? null : $element->hasChildNodes(),
162
+                    'inner_html'   => $element->hasChildNodes() ? $this->mapElements($element->childNodes, new ArrayObject()) : new ArrayObject()
163 163
             ];
164 164
 
165 165
         }
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @return array
175 175
      */
176
-    protected function getAttributes( DOMNode $element ) {
176
+    protected function getAttributes(DOMNode $element) {
177 177
 
178
-        if ( !$element->hasAttributes() ) {
178
+        if (!$element->hasAttributes()) {
179 179
             return [];
180 180
         }
181 181
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
         /**
185 185
          * @var DOMAttr $attr
186 186
          */
187
-        foreach ( $element->attributes as $attr ) {
188
-            $attributesMap[ $attr->nodeName ] = $attr->nodeValue;
187
+        foreach ($element->attributes as $attr) {
188
+            $attributesMap[$attr->nodeName] = $attr->nodeValue;
189 189
         }
190 190
 
191 191
         return $attributesMap;
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
 
201 201
         $htmlNodeList = $this->getNodeListFromQueryPath();
202 202
 
203
-        if ( !$htmlNodeList instanceof DOMNodeList ) {
204
-            throw new DOMException( 'Bad DOMNodeList' );
203
+        if (!$htmlNodeList instanceof DOMNodeList) {
204
+            throw new DOMException('Bad DOMNodeList');
205 205
         }
206 206
 
207
-        if ( $this->isXmlFragment && $htmlNodeList->item( 0 )->nodeName == self::fragmentDocumentRoot ) {
207
+        if ($this->isXmlFragment && $htmlNodeList->item(0)->nodeName == self::fragmentDocumentRoot) {
208 208
             // there is a fake root node, skip the first element end start with child nodes
209
-            $this->mapElements( $htmlNodeList->item( 0 )->childNodes, $this->elements );
209
+            $this->mapElements($htmlNodeList->item(0)->childNodes, $this->elements);
210 210
         } else {
211
-            $this->mapElements( $htmlNodeList, $this->elements );
211
+            $this->mapElements($htmlNodeList, $this->elements);
212 212
         }
213 213
 
214 214
         return $this->elements;
Please login to merge, or discard this patch.