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

Breadcrumb

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

function AbstractCloner::castResource

Casts a resource to an array representation.

Parameters

bool $isNested True if the object is nested in the dumped structure:

1 call to AbstractCloner::castResource()
VarCloner::doClone in vendor/symfony/var-dumper/Cloner/VarCloner.php
Effectively clones the PHP variable.

File

vendor/symfony/var-dumper/Cloner/AbstractCloner.php, line 388

Class

AbstractCloner
AbstractCloner implements a generic caster mechanism for objects and resources.

Namespace

Symfony\Component\VarDumper\Cloner

Code

protected function castResource(Stub $stub, bool $isNested) : array {
    $a = [];
    $res = $stub->value;
    $type = $stub->class;
    try {
        if (!empty($this->casters[':' . $type])) {
            foreach ($this->casters[':' . $type] as $callback) {
                $a = $callback($res, $a, $stub, $isNested, $this->filter);
            }
        }
    } catch (\Exception $e) {
        $a = [
            (Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '') . '⚠' => new ThrowingCasterException($e),
        ] + $a;
    }
    return $a;
}

API Navigation

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