public static function XmlDumper::phpToXml

Converts php types to xml types.

Parameters

mixed $value Value to convert:

Return value

string

Throws

RuntimeException When trying to dump object or resource

1 call to XmlDumper::phpToXml()
XmlDumper::convertParameters in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
Converts parameters.

File

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

Class

XmlDumper
XmlDumper dumps a service container as an XML string.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

public static function phpToXml($value) {
  switch (true) {
    case null === $value:
      return 'null';
    case true === $value:
      return 'true';
    case false === $value:
      return 'false';
    case $value instanceof Parameter:
      return '%' . $value . '%';
    case is_object($value) || is_resource($value):
      throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.');
    default:
      return (string) $value;
  }
}