You are here

public static function XmlDumper::phpToXml in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php \Symfony\Component\DependencyInjection\Dumper\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 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
Converts parameters.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php, line 339

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;
  }
}