You are here

public static function Yaml::dump in Lockr 7.3

Dumps a PHP value to a YAML string.

The dump method, when supplied with an array, will do its best to convert the array into friendly YAML.

Parameters

mixed $input The PHP value:

int $inline The level where you switch to inline YAML:

int $indent The amount of spaces to use for indentation of nested nodes:

int $flags A bit field of DUMP_* constants to customize the dumped YAML string:

Return value

string A YAML string representing the original PHP value

5 calls to Yaml::dump()
Lockr::exportSecretData in vendor/lockr/lockr/src/Lockr.php
Exports secret data to YAML.
ParserTest::testCanParseVeryLongValue in vendor/symfony/yaml/Tests/ParserTest.php
YamlTest::testNegativeIndentationThrowsException in vendor/symfony/yaml/Tests/YamlTest.php
@expectedException \InvalidArgumentException @expectedExceptionMessage The indentation must be greater than zero
YamlTest::testParseAndDump in vendor/symfony/yaml/Tests/YamlTest.php
YamlTest::testZeroIndentationThrowsException in vendor/symfony/yaml/Tests/YamlTest.php
@expectedException \InvalidArgumentException @expectedExceptionMessage The indentation must be greater than zero

File

vendor/symfony/yaml/Yaml.php, line 126

Class

Yaml
Yaml offers convenience methods to load and dump YAML.

Namespace

Symfony\Component\Yaml

Code

public static function dump($input, $inline = 2, $indent = 4, $flags = 0) {
  if (\is_bool($flags)) {
    @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
    if ($flags) {
      $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE;
    }
    else {
      $flags = 0;
    }
  }
  if (\func_num_args() >= 5) {
    @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
    if (func_get_arg(4)) {
      $flags |= self::DUMP_OBJECT;
    }
  }
  $yaml = new Dumper($indent);
  return $yaml
    ->dump($input, $inline, 0, $flags);
}