Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/var-dumper/Caster/XmlReaderCaster.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
17 * | 17 * |
18 * @author Baptiste ClaviƩ <clavie.b@gmail.com> | 18 * @author Baptiste ClaviƩ <clavie.b@gmail.com> |
19 */ | 19 */ |
20 class XmlReaderCaster | 20 class XmlReaderCaster |
21 { | 21 { |
22 private static $nodeTypes = array( | 22 private static $nodeTypes = [ |
23 \XMLReader::NONE => 'NONE', | 23 \XMLReader::NONE => 'NONE', |
24 \XMLReader::ELEMENT => 'ELEMENT', | 24 \XMLReader::ELEMENT => 'ELEMENT', |
25 \XMLReader::ATTRIBUTE => 'ATTRIBUTE', | 25 \XMLReader::ATTRIBUTE => 'ATTRIBUTE', |
26 \XMLReader::TEXT => 'TEXT', | 26 \XMLReader::TEXT => 'TEXT', |
27 \XMLReader::CDATA => 'CDATA', | 27 \XMLReader::CDATA => 'CDATA', |
36 \XMLReader::WHITESPACE => 'WHITESPACE', | 36 \XMLReader::WHITESPACE => 'WHITESPACE', |
37 \XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE', | 37 \XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE', |
38 \XMLReader::END_ELEMENT => 'END_ELEMENT', | 38 \XMLReader::END_ELEMENT => 'END_ELEMENT', |
39 \XMLReader::END_ENTITY => 'END_ENTITY', | 39 \XMLReader::END_ENTITY => 'END_ENTITY', |
40 \XMLReader::XML_DECLARATION => 'XML_DECLARATION', | 40 \XMLReader::XML_DECLARATION => 'XML_DECLARATION', |
41 ); | 41 ]; |
42 | 42 |
43 public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested) | 43 public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested) |
44 { | 44 { |
45 $props = Caster::PREFIX_VIRTUAL.'parserProperties'; | 45 $props = Caster::PREFIX_VIRTUAL.'parserProperties'; |
46 $info = array( | 46 $info = [ |
47 'localName' => $reader->localName, | 47 'localName' => $reader->localName, |
48 'prefix' => $reader->prefix, | 48 'prefix' => $reader->prefix, |
49 'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType), | 49 'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType), |
50 'depth' => $reader->depth, | 50 'depth' => $reader->depth, |
51 'isDefault' => $reader->isDefault, | 51 'isDefault' => $reader->isDefault, |
53 'xmlLang' => $reader->xmlLang, | 53 'xmlLang' => $reader->xmlLang, |
54 'attributeCount' => $reader->attributeCount, | 54 'attributeCount' => $reader->attributeCount, |
55 'value' => $reader->value, | 55 'value' => $reader->value, |
56 'namespaceURI' => $reader->namespaceURI, | 56 'namespaceURI' => $reader->namespaceURI, |
57 'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI, | 57 'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI, |
58 $props => array( | 58 $props => [ |
59 'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD), | 59 'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD), |
60 'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS), | 60 'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS), |
61 'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE), | 61 'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE), |
62 'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES), | 62 'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES), |
63 ), | 63 ], |
64 ); | 64 ]; |
65 | 65 |
66 if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) { | 66 if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) { |
67 $info[$props] = new EnumStub($info[$props]); | 67 $info[$props] = new EnumStub($info[$props]); |
68 $info[$props]->cut = $count; | 68 $info[$props]->cut = $count; |
69 } | 69 } |
70 | 70 |
71 $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count); | 71 $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count); |
72 // +2 because hasValue and hasAttributes are always filtered | 72 // +2 because hasValue and hasAttributes are always filtered |
73 $stub->cut += $count + 2; | 73 $stub->cut += $count + 2; |
74 | 74 |
75 return $a + $info; | 75 return $a + $info; |
76 } | 76 } |