You are here

protected function PhpArrayDumper::dumpCallable in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php \Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper::dumpCallable()

Dumps callable to YAML format

Parameters

callable $callable:

Return value

callable

1 call to PhpArrayDumper::dumpCallable()
PhpArrayDumper::getServiceDefinition in lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
Gets a service definition as PHP array.

File

lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php, line 244
Contains \Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper

Class

PhpArrayDumper
PhpArrayDumper dumps a service container as a serialized PHP array.

Namespace

Drupal\Core\DependencyInjection\Dumper

Code

protected function dumpCallable($callable) {
  if (is_array($callable)) {
    if ($callable[0] instanceof Reference) {
      $callable = array(
        $this
          ->getServiceCall((string) $callable[0], $callable[0]),
        $callable[1],
      );
    }
    elseif ($callable[0] instanceof Definition) {
      $callable[0] = $this
        ->getPrivateService($callable[0]);
      $callable = array(
        $callable[0],
        $callable[1],
      );
    }
    else {
      $callable = array(
        $callable[0],
        $callable[1],
      );
    }
  }
  return $callable;
}