PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.12.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.12.1
5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / var-dumper / Caster / DOMCaster.php
matomo / app / vendor / prefixed / symfony / var-dumper / Caster Last commit date
AmqpCaster.php 2 years ago ArgsStub.php 1 year ago Caster.php 1 year ago ClassStub.php 1 year ago ConstStub.php 2 years ago CutArrayStub.php 2 years ago CutStub.php 1 year ago DOMCaster.php 1 year ago DateCaster.php 2 years ago DoctrineCaster.php 2 years ago DsCaster.php 2 years ago DsPairStub.php 2 years ago EnumStub.php 1 year ago ExceptionCaster.php 1 year ago FiberCaster.php 2 years ago FrameStub.php 1 year ago GmpCaster.php 2 years ago ImagineCaster.php 2 years ago ImgStub.php 2 years ago IntlCaster.php 2 years ago LinkStub.php 1 year ago MemcachedCaster.php 2 years ago MysqliCaster.php 2 years ago PdoCaster.php 2 years ago PgSqlCaster.php 1 year ago ProxyManagerCaster.php 2 years ago RdKafkaCaster.php 1 year ago RedisCaster.php 2 years ago ReflectionCaster.php 1 year ago ResourceCaster.php 1 year ago SplCaster.php 1 year ago StubCaster.php 2 years ago SymfonyCaster.php 2 years ago TraceStub.php 1 year ago UuidCaster.php 2 years ago XmlReaderCaster.php 1 year ago XmlResourceCaster.php 2 years ago
DOMCaster.php
125 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace Matomo\Dependencies\Symfony\Component\VarDumper\Caster;
12
13 use Matomo\Dependencies\Symfony\Component\VarDumper\Cloner\Stub;
14 /**
15 * Casts DOM related classes to array representation.
16 *
17 * @author Nicolas Grekas <p@tchwork.com>
18 *
19 * @final
20 */
21 class DOMCaster
22 {
23 private const ERROR_CODES = [0 => 'DOM_PHP_ERR', \DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', \DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', \DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', \DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR', \DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR', \DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR', \DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR', \DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR', \DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR', \DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR', \DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR', \DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR', \DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR', \DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR', \DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR', \DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR'];
24 private const NODE_TYPES = [\XML_ELEMENT_NODE => 'XML_ELEMENT_NODE', \XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE', \XML_TEXT_NODE => 'XML_TEXT_NODE', \XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE', \XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE', \XML_ENTITY_NODE => 'XML_ENTITY_NODE', \XML_PI_NODE => 'XML_PI_NODE', \XML_COMMENT_NODE => 'XML_COMMENT_NODE', \XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE', \XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE', \XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE', \XML_NOTATION_NODE => 'XML_NOTATION_NODE', \XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE', \XML_DTD_NODE => 'XML_DTD_NODE', \XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE', \XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE', \XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE', \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE'];
25 public static function castException(\DOMException $e, array $a, Stub $stub, bool $isNested)
26 {
27 $k = Caster::PREFIX_PROTECTED . 'code';
28 if (isset($a[$k], self::ERROR_CODES[$a[$k]])) {
29 $a[$k] = new ConstStub(self::ERROR_CODES[$a[$k]], $a[$k]);
30 }
31 return $a;
32 }
33 public static function castLength($dom, array $a, Stub $stub, bool $isNested)
34 {
35 $a += ['length' => $dom->length];
36 return $a;
37 }
38 public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested)
39 {
40 $a += [Caster::PREFIX_VIRTUAL . 'Core' => '1.0', Caster::PREFIX_VIRTUAL . 'XML' => '2.0'];
41 return $a;
42 }
43 public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNested)
44 {
45 $a += ['nodeName' => $dom->nodeName, 'nodeValue' => new CutStub($dom->nodeValue), 'nodeType' => new ConstStub(self::NODE_TYPES[$dom->nodeType], $dom->nodeType), 'parentNode' => new CutStub($dom->parentNode), 'childNodes' => $dom->childNodes, 'firstChild' => new CutStub($dom->firstChild), 'lastChild' => new CutStub($dom->lastChild), 'previousSibling' => new CutStub($dom->previousSibling), 'nextSibling' => new CutStub($dom->nextSibling), 'attributes' => $dom->attributes, 'ownerDocument' => new CutStub($dom->ownerDocument), 'namespaceURI' => $dom->namespaceURI, 'prefix' => $dom->prefix, 'localName' => $dom->localName, 'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI, 'textContent' => new CutStub($dom->textContent)];
46 return $a;
47 }
48 public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested)
49 {
50 $a += ['nodeName' => $dom->nodeName, 'nodeValue' => new CutStub($dom->nodeValue), 'nodeType' => new ConstStub(self::NODE_TYPES[$dom->nodeType], $dom->nodeType), 'prefix' => $dom->prefix, 'localName' => $dom->localName, 'namespaceURI' => $dom->namespaceURI, 'ownerDocument' => new CutStub($dom->ownerDocument), 'parentNode' => new CutStub($dom->parentNode)];
51 return $a;
52 }
53 public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0)
54 {
55 $a += ['doctype' => $dom->doctype, 'implementation' => $dom->implementation, 'documentElement' => new CutStub($dom->documentElement), 'encoding' => $dom->encoding, 'xmlEncoding' => $dom->xmlEncoding, 'xmlStandalone' => $dom->xmlStandalone, 'xmlVersion' => $dom->xmlVersion, 'strictErrorChecking' => $dom->strictErrorChecking, 'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI, 'formatOutput' => $dom->formatOutput, 'validateOnParse' => $dom->validateOnParse, 'resolveExternals' => $dom->resolveExternals, 'preserveWhiteSpace' => $dom->preserveWhiteSpace, 'recover' => $dom->recover, 'substituteEntities' => $dom->substituteEntities];
56 if (!($filter & Caster::EXCLUDE_VERBOSE)) {
57 $formatOutput = $dom->formatOutput;
58 $dom->formatOutput = \true;
59 $a += [Caster::PREFIX_VIRTUAL . 'xml' => $dom->saveXML()];
60 $dom->formatOutput = $formatOutput;
61 }
62 return $a;
63 }
64 public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested)
65 {
66 $a += ['data' => $dom->data, 'length' => $dom->length];
67 return $a;
68 }
69 public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested)
70 {
71 $a += ['name' => $dom->name, 'specified' => $dom->specified, 'value' => $dom->value, 'ownerElement' => $dom->ownerElement, 'schemaTypeInfo' => $dom->schemaTypeInfo];
72 return $a;
73 }
74 public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested)
75 {
76 $a += ['tagName' => $dom->tagName, 'schemaTypeInfo' => $dom->schemaTypeInfo];
77 return $a;
78 }
79 public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested)
80 {
81 $a += ['wholeText' => $dom->wholeText];
82 return $a;
83 }
84 public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, bool $isNested)
85 {
86 $a += ['typeName' => $dom->typeName, 'typeNamespace' => $dom->typeNamespace];
87 return $a;
88 }
89 public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, bool $isNested)
90 {
91 $a += ['severity' => $dom->severity, 'message' => $dom->message, 'type' => $dom->type, 'relatedException' => $dom->relatedException, 'related_data' => $dom->related_data, 'location' => $dom->location];
92 return $a;
93 }
94 public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, bool $isNested)
95 {
96 $a += ['lineNumber' => $dom->lineNumber, 'columnNumber' => $dom->columnNumber, 'offset' => $dom->offset, 'relatedNode' => $dom->relatedNode, 'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri];
97 return $a;
98 }
99 public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested)
100 {
101 $a += ['name' => $dom->name, 'entities' => $dom->entities, 'notations' => $dom->notations, 'publicId' => $dom->publicId, 'systemId' => $dom->systemId, 'internalSubset' => $dom->internalSubset];
102 return $a;
103 }
104 public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested)
105 {
106 $a += ['publicId' => $dom->publicId, 'systemId' => $dom->systemId];
107 return $a;
108 }
109 public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested)
110 {
111 $a += ['publicId' => $dom->publicId, 'systemId' => $dom->systemId, 'notationName' => $dom->notationName];
112 return $a;
113 }
114 public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested)
115 {
116 $a += ['target' => $dom->target, 'data' => $dom->data];
117 return $a;
118 }
119 public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, bool $isNested)
120 {
121 $a += ['document' => $dom->document];
122 return $a;
123 }
124 }
125