Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DOMCaster.php

function DOMCaster::castNode

File

vendor/symfony/var-dumper/Caster/DOMCaster.php, line 95

Class

DOMCaster
Casts DOM related classes to array representation.

Namespace

Symfony\Component\VarDumper\Caster

Code

public static function castNode(\DOMNode|\Dom\Node $dom, array $a, Stub $stub, bool $isNested) : array {
    $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),
        'ownerDocument' => new CutStub($dom->ownerDocument),
        'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
        'textContent' => new CutStub($dom->textContent),
    ];
    if ($dom instanceof \DOMNode || $dom instanceof \Dom\Element) {
        $a += [
            'attributes' => $dom->attributes,
            'namespaceURI' => $dom->namespaceURI,
            'prefix' => $dom->prefix,
            'localName' => $dom->localName,
        ];
    }
    return $a;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal