Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/var-dumper/Caster/XmlResourceCaster.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 | |
12 namespace Symfony\Component\VarDumper\Caster; | |
13 | |
14 use Symfony\Component\VarDumper\Cloner\Stub; | |
15 | |
16 /** | |
17 * Casts XML resources to array representation. | |
18 * | |
19 * @author Nicolas Grekas <p@tchwork.com> | |
20 */ | |
21 class XmlResourceCaster | |
22 { | |
23 private static $xmlErrors = array( | |
24 XML_ERROR_NONE => 'XML_ERROR_NONE', | |
25 XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', | |
26 XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', | |
27 XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', | |
28 XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', | |
29 XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', | |
30 XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', | |
31 XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', | |
32 XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', | |
33 XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', | |
34 XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', | |
35 XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', | |
36 XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', | |
37 XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', | |
38 XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', | |
39 XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', | |
40 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', | |
41 XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', | |
42 XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', | |
43 XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', | |
44 XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', | |
45 XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', | |
46 ); | |
47 | |
48 public static function castXml($h, array $a, Stub $stub, $isNested) | |
49 { | |
50 $a['current_byte_index'] = xml_get_current_byte_index($h); | |
51 $a['current_column_number'] = xml_get_current_column_number($h); | |
52 $a['current_line_number'] = xml_get_current_line_number($h); | |
53 $a['error_code'] = xml_get_error_code($h); | |
54 | |
55 if (isset(self::$xmlErrors[$a['error_code']])) { | |
56 $a['error_code'] = new ConstStub(self::$xmlErrors[$a['error_code']], $a['error_code']); | |
57 } | |
58 | |
59 return $a; | |
60 } | |
61 } |