mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 05:29:53 +09:00
Update to laravel 7
This commit is contained in:
@@ -16,10 +16,12 @@ use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
* Casts XmlReader class to array representation.
|
||||
*
|
||||
* @author Baptiste Clavié <clavie.b@gmail.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class XmlReaderCaster
|
||||
{
|
||||
private static $nodeTypes = [
|
||||
private const NODE_TYPES = [
|
||||
\XMLReader::NONE => 'NONE',
|
||||
\XMLReader::ELEMENT => 'ELEMENT',
|
||||
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
|
||||
@@ -40,13 +42,29 @@ class XmlReaderCaster
|
||||
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
|
||||
];
|
||||
|
||||
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
|
||||
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested)
|
||||
{
|
||||
try {
|
||||
$properties = [
|
||||
'LOADDTD' => @$reader->getParserProperty(\XMLReader::LOADDTD),
|
||||
'DEFAULTATTRS' => @$reader->getParserProperty(\XMLReader::DEFAULTATTRS),
|
||||
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
|
||||
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
|
||||
];
|
||||
} catch (\Error $e) {
|
||||
$properties = [
|
||||
'LOADDTD' => false,
|
||||
'DEFAULTATTRS' => false,
|
||||
'VALIDATE' => false,
|
||||
'SUBST_ENTITIES' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
|
||||
$info = [
|
||||
'localName' => $reader->localName,
|
||||
'prefix' => $reader->prefix,
|
||||
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
|
||||
'nodeType' => new ConstStub(self::NODE_TYPES[$reader->nodeType], $reader->nodeType),
|
||||
'depth' => $reader->depth,
|
||||
'isDefault' => $reader->isDefault,
|
||||
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
|
||||
@@ -55,12 +73,7 @@ class XmlReaderCaster
|
||||
'value' => $reader->value,
|
||||
'namespaceURI' => $reader->namespaceURI,
|
||||
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
|
||||
$props => [
|
||||
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
|
||||
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
|
||||
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
|
||||
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
|
||||
],
|
||||
$props => $properties,
|
||||
];
|
||||
|
||||
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {
|
||||
|
||||
Reference in New Issue
Block a user