@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $dump = ''; |
| 41 | 41 | // Note that the header is added at the end, so we can add stats |
| 42 | - $dump .= '[' . PHP_EOL; |
|
| 42 | + $dump .= '['.PHP_EOL; |
|
| 43 | 43 | |
| 44 | 44 | // SimpleXML objects can be either a single node, or (more commonly) a list of 0 or more nodes |
| 45 | 45 | // I haven't found a reliable way of distinguishing between the two cases |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | $dump .= self::dumpAddElement($item); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - $dump .= ']' . PHP_EOL; |
|
| 64 | + $dump .= ']'.PHP_EOL; |
|
| 65 | 65 | |
| 66 | 66 | // Add on the header line, with the total number of items output |
| 67 | - return self::getHeaderLine($item_index) . $dump; |
|
| 67 | + return self::getHeaderLine($item_index).$dump; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | // To what namespace does this attribute belong? Returns array( alias => URI ) |
| 78 | 78 | $ns = $item->getNamespaces(FALSE); |
| 79 | 79 | if ($ns) { |
| 80 | - $dump .= self::INDENT . self::INDENT . 'Namespace: \'' . reset($ns) . |
|
| 81 | - '\'' . |
|
| 80 | + $dump .= self::INDENT.self::INDENT.'Namespace: \''.reset($ns). |
|
| 81 | + '\''. |
|
| 82 | 82 | PHP_EOL; |
| 83 | 83 | if (key($ns) == '') { |
| 84 | - $dump .= self::INDENT . self::INDENT . '(Default Namespace)' . PHP_EOL; |
|
| 84 | + $dump .= self::INDENT.self::INDENT.'(Default Namespace)'.PHP_EOL; |
|
| 85 | 85 | } else { |
| 86 | - $dump .= self::INDENT . self::INDENT . 'Namespace Alias: \'' . |
|
| 87 | - key($ns) . |
|
| 88 | - '\'' . |
|
| 86 | + $dump .= self::INDENT.self::INDENT.'Namespace Alias: \''. |
|
| 87 | + key($ns). |
|
| 88 | + '\''. |
|
| 89 | 89 | PHP_EOL; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | $data, |
| 105 | 105 | $indent = 1, |
| 106 | 106 | $backtick = TRUE): string { |
| 107 | - return str_repeat(self::INDENT, $indent) . $title . ': ' . |
|
| 108 | - ($backtick ? '\'' : '') . $data . |
|
| 109 | - ($backtick ? '\'' : '') . PHP_EOL; |
|
| 107 | + return str_repeat(self::INDENT, $indent).$title.': '. |
|
| 108 | + ($backtick ? '\'' : '').$data. |
|
| 109 | + ($backtick ? '\'' : '').PHP_EOL; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | private static function dumpAddAttribute(\SimpleXMLElement $item): string { |
| 117 | 117 | |
| 118 | - $dump = self::INDENT . 'Attribute {' . PHP_EOL; |
|
| 118 | + $dump = self::INDENT.'Attribute {'.PHP_EOL; |
|
| 119 | 119 | |
| 120 | 120 | $dump .= self::dumpAddNamespace($item); |
| 121 | 121 | |
| 122 | 122 | $dump .= self::dumpGetLine('Name', $item->getName(), 2); |
| 123 | 123 | $dump .= self::dumpGetLine('Value', (string) $item, 2); |
| 124 | 124 | |
| 125 | - $dump .= self::INDENT . '}' . PHP_EOL; |
|
| 125 | + $dump .= self::INDENT.'}'.PHP_EOL; |
|
| 126 | 126 | return $dump; |
| 127 | 127 | |
| 128 | 128 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private static function dumpAddElement(\SimpleXMLElement $item): string { |
| 135 | 135 | |
| 136 | - $dump = self::INDENT . 'Element {' . PHP_EOL; |
|
| 136 | + $dump = self::INDENT.'Element {'.PHP_EOL; |
|
| 137 | 137 | |
| 138 | 138 | $dump .= self::dumpAddNamespace($item); |
| 139 | 139 | |
@@ -176,10 +176,9 @@ discard block |
||
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $ns_label = (($ns_alias === '') ? 'Default Namespace' : |
|
| 180 | - "Namespace $ns_alias"); |
|
| 179 | + $ns_label = (($ns_alias === '') ? 'Default Namespace' : "Namespace $ns_alias"); |
|
| 181 | 180 | |
| 182 | - $dump .= self::INDENT . self::INDENT . 'Content in ' . $ns_label . |
|
| 181 | + $dump .= self::INDENT.self::INDENT.'Content in '.$ns_label. |
|
| 183 | 182 | PHP_EOL; |
| 184 | 183 | |
| 185 | 184 | if (NULL !== $ns_uri) { |
@@ -199,7 +198,7 @@ discard block |
||
| 199 | 198 | FALSE); |
| 200 | 199 | } |
| 201 | 200 | |
| 202 | - return $dump . self::INDENT . '}' . PHP_EOL; |
|
| 201 | + return $dump.self::INDENT.'}'.PHP_EOL; |
|
| 203 | 202 | } |
| 204 | 203 | |
| 205 | 204 | /** |
@@ -228,7 +227,7 @@ discard block |
||
| 228 | 227 | $childrenString = count($children); |
| 229 | 228 | // Don't output a trailing " - " if there are no children |
| 230 | 229 | if (count($children) > 0) { |
| 231 | - $childrenString .= ' - ' . implode(', ', $child_name_output); |
|
| 230 | + $childrenString .= ' - '.implode(', ', $child_name_output); |
|
| 232 | 231 | } |
| 233 | 232 | return $childrenString; |
| 234 | 233 | } |
@@ -241,14 +240,14 @@ discard block |
||
| 241 | 240 | // Attributes can't be duplicated, but I'm going to put them in alphabetical order |
| 242 | 241 | $attribute_names = []; |
| 243 | 242 | foreach ($attributes as $sx_attribute) { |
| 244 | - $attribute_names[] = "'" . $sx_attribute->getName() . "'"; |
|
| 243 | + $attribute_names[] = "'".$sx_attribute->getName()."'"; |
|
| 245 | 244 | } |
| 246 | 245 | ksort($attribute_names); |
| 247 | 246 | |
| 248 | 247 | $attString = count($attributes); |
| 249 | 248 | // Don't output a trailing " - " if there are no attributes |
| 250 | 249 | if (count($attributes) > 0) { |
| 251 | - $attString .= ' - ' . implode(', ', $attribute_names); |
|
| 250 | + $attString .= ' - '.implode(', ', $attribute_names); |
|
| 252 | 251 | } |
| 253 | 252 | return $attString; |
| 254 | 253 | } |
@@ -259,8 +258,8 @@ discard block |
||
| 259 | 258 | */ |
| 260 | 259 | private static function getHeaderLine($index): string { |
| 261 | 260 | |
| 262 | - return 'SimpleXML object (' . $index . ' item' . |
|
| 263 | - ($index > 1 ? 's' : '') . ')' . PHP_EOL; |
|
| 261 | + return 'SimpleXML object ('.$index.' item'. |
|
| 262 | + ($index > 1 ? 's' : '').')'.PHP_EOL; |
|
| 264 | 263 | } |
| 265 | 264 | |
| 266 | 265 | /** |
@@ -304,9 +303,9 @@ discard block |
||
| 304 | 303 | // To what namespace does this attribute belong? Returns array( alias => URI ) |
| 305 | 304 | $ns = $root_item->getNamespaces(FALSE); |
| 306 | 305 | if (key($ns)) { |
| 307 | - $dump .= key($ns) . ':'; |
|
| 306 | + $dump .= key($ns).':'; |
|
| 308 | 307 | } |
| 309 | - $dump .= $root_item->getName() . '="' . (string) $root_item . '"' . |
|
| 308 | + $dump .= $root_item->getName().'="'.(string) $root_item.'"'. |
|
| 310 | 309 | PHP_EOL; |
| 311 | 310 | } else { |
| 312 | 311 | // Display the root node as a numeric key reference, plus a hint as to its tag name |
@@ -315,11 +314,11 @@ discard block |
||
| 315 | 314 | // To what namespace does this attribute belong? Returns array( alias => URI ) |
| 316 | 315 | $ns = $root_item->getNamespaces(FALSE); |
| 317 | 316 | if (key($ns)) { |
| 318 | - $root_node_name = key($ns) . ':' . $root_item->getName(); |
|
| 317 | + $root_node_name = key($ns).':'.$root_item->getName(); |
|
| 319 | 318 | } else { |
| 320 | 319 | $root_node_name = $root_item->getName(); |
| 321 | 320 | } |
| 322 | - $dump .= "[$root_item_index] // <$root_node_name>" . PHP_EOL; |
|
| 321 | + $dump .= "[$root_item_index] // <$root_node_name>".PHP_EOL; |
|
| 323 | 322 | |
| 324 | 323 | // This function is effectively recursing depth-first through the tree, |
| 325 | 324 | // but this is managed manually using a stack rather than actual recursion |
@@ -335,7 +334,7 @@ discard block |
||
| 335 | 334 | } |
| 336 | 335 | |
| 337 | 336 | // Add on the header line, with the total number of items output |
| 338 | - $dump = self::getHeaderLine($root_item_index) . $dump; |
|
| 337 | + $dump = self::getHeaderLine($root_item_index).$dump; |
|
| 339 | 338 | |
| 340 | 339 | return $dump; |
| 341 | 340 | |
@@ -358,7 +357,7 @@ discard block |
||
| 358 | 357 | str_repeat(SxmlDebug::INDENT, $depth) |
| 359 | 358 | . '(string) ' |
| 360 | 359 | . "'$string_extract'" |
| 361 | - . ' (' . strlen($stringContent) . ' chars)' |
|
| 360 | + . ' ('.strlen($stringContent).' chars)' |
|
| 362 | 361 | . PHP_EOL : ''; |
| 363 | 362 | |
| 364 | 363 | } |
@@ -405,7 +404,7 @@ discard block |
||
| 405 | 404 | if (count($attributes) > 0) { |
| 406 | 405 | if (!$isCurrentNamespace) { |
| 407 | 406 | $dump .= str_repeat(self::INDENT, $depth) |
| 408 | - . "->attributes('$nsAlias', true)" . PHP_EOL; |
|
| 407 | + . "->attributes('$nsAlias', true)".PHP_EOL; |
|
| 409 | 408 | } |
| 410 | 409 | |
| 411 | 410 | foreach ($attributes as $sx_attribute) { |
@@ -414,14 +413,14 @@ discard block |
||
| 414 | 413 | // In current namespace |
| 415 | 414 | // e.g. ['attribName'] |
| 416 | 415 | $dump .= str_repeat(self::INDENT, $depth) |
| 417 | - . "['" . $sx_attribute->getName() . "']" |
|
| 416 | + . "['".$sx_attribute->getName()."']" |
|
| 418 | 417 | . PHP_EOL; |
| 419 | 418 | $string_display_depth = $depth + 1; |
| 420 | 419 | } else { |
| 421 | 420 | // After a call to ->attributes() |
| 422 | 421 | // e.g. ->attribName |
| 423 | 422 | $dump .= str_repeat(self::INDENT, $depth + 1) |
| 424 | - . '->' . $sx_attribute->getName() |
|
| 423 | + . '->'.$sx_attribute->getName() |
|
| 425 | 424 | . PHP_EOL; |
| 426 | 425 | $string_display_depth = $depth + 2; |
| 427 | 426 | } |
@@ -456,7 +455,7 @@ discard block |
||
| 456 | 455 | $display_depth = $depth; |
| 457 | 456 | } else { |
| 458 | 457 | $dump .= str_repeat(self::INDENT, $depth) |
| 459 | - . "->children('$nsAlias', true)" . PHP_EOL; |
|
| 458 | + . "->children('$nsAlias', true)".PHP_EOL; |
|
| 460 | 459 | $display_depth = $depth + 1; |
| 461 | 460 | } |
| 462 | 461 | |
@@ -474,8 +473,8 @@ discard block |
||
| 474 | 473 | |
| 475 | 474 | // e.g. ->Foo[0] |
| 476 | 475 | $dump .= str_repeat(self::INDENT, $display_depth) |
| 477 | - . '->' . $sx_child->getName() |
|
| 478 | - . '[' . ($child_names[$child_node_name] - 1) . ']' |
|
| 476 | + . '->'.$sx_child->getName() |
|
| 477 | + . '['.($child_names[$child_node_name] - 1).']' |
|
| 479 | 478 | . PHP_EOL; |
| 480 | 479 | |
| 481 | 480 | $dump .= self::recursivelyProcessNode( |