You are here

public static function XmlDumper::phpToXml in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/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 vendor/symfony/dependency-injection/Dumper/XmlDumper.php
Converts parameters.

File

vendor/symfony/dependency-injection/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;
  }
}