You are here

public static function Yaml::parse in Database Sanitize 7

Parses YAML into a PHP value.

Usage: <code> $array = Yaml::parse(file_get_contents('config.yml')); print_r($array); </code>

Parameters

string $input A string containing YAML:

int $flags A bit field of PARSE_* constants to customize the YAML parser behavior:

Return value

mixed The YAML converted to a PHP value

Throws

ParseException If the YAML is not valid

20 calls to Yaml::parse()
DatabaseSanitizeCase::testDatabaseSanitizeCommands in drush/tests/DatabaseSanitizeTest.php
Tests Database Sanitize drush commands.
database_sanitize_get_unspecified_tables in inc/database_sanitize.inc
Procedural version of DatabaseSanitize::getUnspecifiedTables().
DumperTest::testDumpObjectAsMap in vendor/symfony/yaml/Tests/DumperTest.php
@dataProvider objectAsMapProvider
InlineTest::testExplicitStringCastingOfMappingKeys in vendor/symfony/yaml/Tests/InlineTest.php
@group legacy @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead. @expectedDeprecation Implicit casting of incompatible mapping…
MergeYaml::getMergedYmlContent in vendor/edisonlabs/merge-yaml/src/MergeYaml.php
Returns the content of the merged yaml files.

... See full list

File

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

Class

Yaml
Yaml offers convenience methods to load and dump YAML.

Namespace

Symfony\Component\Yaml

Code

public static function parse($input, $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 PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
    if ($flags) {
      $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE;
    }
    else {
      $flags = 0;
    }
  }
  if (\func_num_args() >= 3) {
    @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 PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
    if (func_get_arg(2)) {
      $flags |= self::PARSE_OBJECT;
    }
  }
  if (\func_num_args() >= 4) {
    @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
    if (func_get_arg(3)) {
      $flags |= self::PARSE_OBJECT_FOR_MAP;
    }
  }
  $yaml = new Parser();
  return $yaml
    ->parse($input, $flags);
}