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

Breadcrumb

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

function CliDumper::enterHash

Overrides DumperInterface::enterHash

2 calls to CliDumper::enterHash()
HtmlDumper::enterHash in vendor/symfony/var-dumper/Dumper/HtmlDumper.php
Dumps while entering an hash.
HtmlDumper::enterHash in vendor/symfony/var-dumper/Dumper/HtmlDumper.php
Dumps while entering an hash.
1 method overrides CliDumper::enterHash()
HtmlDumper::enterHash in vendor/symfony/var-dumper/Dumper/HtmlDumper.php
Dumps while entering an hash.

File

vendor/symfony/var-dumper/Dumper/CliDumper.php, line 276

Class

CliDumper
CliDumper dumps variables for command line output.

Namespace

Symfony\Component\VarDumper\Dumper

Code

public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild) : void {
    $this->colors ??= $this->supportsColors();
    $this->dumpKey($cursor);
    $this->expandNextHash = false;
    $attr = $cursor->attr;
    if ($this->collapseNextHash) {
        $cursor->skipChildren = true;
        $this->collapseNextHash = $hasChild = false;
    }
    $class = $this->utf8Encode($class);
    if (Cursor::HASH_OBJECT === $type) {
        $prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr) . (empty($attr['cut_hash']) ? ' {' : '') : '{';
    }
    elseif (Cursor::HASH_RESOURCE === $type) {
        $prefix = $this->style('note', $class . ' resource', $attr) . ($hasChild ? ' {' : ' ');
    }
    else {
        $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:' . $class) . ' [' : '[';
    }
    if (($cursor->softRefCount || 0 < $cursor->softRefHandle) && empty($attr['cut_hash'])) {
        $prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#') . (0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), [
            'count' => $cursor->softRefCount,
        ]);
    }
    elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) {
        $prefix .= $this->style('ref', '&' . $cursor->hardRefTo, [
            'count' => $cursor->hardRefCount,
        ]);
    }
    elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) {
        $prefix = substr($prefix, 0, -1);
    }
    $this->line .= $prefix;
    if ($hasChild) {
        $this->dumpLine($cursor->depth);
    }
}
RSS feed
Powered by Drupal