You are here

public static function Escaper::requiresSingleQuoting in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Symfony/Component/Yaml/Escaper.php \Symfony\Component\Yaml\Escaper::requiresSingleQuoting()
  2. 7.2 vendor/Symfony/Component/Yaml/Escaper.php \Symfony\Component\Yaml\Escaper::requiresSingleQuoting()

Determines if a PHP value would require single quoting in YAML.

Parameters

string $value A PHP value:

Return value

Boolean True if the value would require single quotes.

1 call to Escaper::requiresSingleQuoting()
Inline::dump in vendor/Symfony/Component/Yaml/Inline.php
Dumps a given PHP variable to a YAML string.

File

vendor/Symfony/Component/Yaml/Escaper.php, line 72

Class

Escaper
Escaper encapsulates escaping rules for single and double-quoted YAML strings.

Namespace

Symfony\Component\Yaml

Code

public static function requiresSingleQuoting($value) {
  return preg_match('/[ \\s \' " \\: \\{ \\} \\[ \\] , & \\* \\# \\?] | \\A[ - ? | < > = ! % @ ` ]/x', $value);
}