You are here

public static function Yaml::dump in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php \Symfony\Component\Yaml\Yaml::dump()

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:

bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise:

bool $objectSupport True if object support is enabled, false otherwise:

Return value

string A YAML string representing the original PHP value

6 calls to Yaml::dump()
ParserTest::testCanParseVeryLongValue in vendor/symfony/yaml/Tests/ParserTest.php
YAMLExporter::compile in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/YAMLExporter.php
Build the string content of $this->output and return $this for chaining.
YAMLFrontMatterExporter::compile in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/YAMLFrontMatterExporter.php
Build the string content of $this->output and return $this for chaining.
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

... See full list

File

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

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, $exceptionOnInvalidType = false, $objectSupport = false) {
  if ($indent < 1) {
    throw new \InvalidArgumentException('The indentation must be greater than zero.');
  }
  $yaml = new Dumper();
  $yaml
    ->setIndentation($indent);
  return $yaml
    ->dump($input, $inline, 0, $exceptionOnInvalidType, $objectSupport);
}