private function YamlDumper::dumpValue

Dumps the value to YAML format

Parameters

mixed $value:

Throws

RuntimeException When trying to dump object or resource

1 call to YamlDumper::dumpValue()
YamlDumper::addService in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
Adds a service

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php, line 201

Class

YamlDumper
YamlDumper dumps a service container as a YAML string.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function dumpValue($value) {
  if (is_array($value)) {
    $code = array();
    foreach ($value as $k => $v) {
      $code[$k] = $this
        ->dumpValue($v);
    }
    return $code;
  }
  elseif (is_object($value) && $value instanceof Reference) {
    return $this
      ->getServiceCall((string) $value, $value);
  }
  elseif (is_object($value) && $value instanceof Parameter) {
    return $this
      ->getParameterCall((string) $value);
  }
  elseif (is_object($value) || is_resource($value)) {
    throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.');
  }
  return $value;
}