14 use Symfony\Component\Yaml\Yaml as VendorYaml;
51 public static function dump(
$var, $inline = 4, $indent = 4)
54 $ret = VendorYaml::dump(
$var, $inline, $indent);
55 }
catch (\Exception $e) {
69 public static function load($yamlString)
72 $ret = VendorYaml::parse($yamlString);
73 }
catch (\Exception $e) {
87 public static function read($yamlFile)
90 $yamlString = file_get_contents($yamlFile);
91 $ret = VendorYaml::parse($yamlString);
92 }
catch (\Exception $e) {
109 public static function save(
$var, $yamlFile, $inline = 4, $indent = 4)
112 $yamlString = VendorYaml::dump(
$var, $inline, $indent);
113 $ret = file_put_contents($yamlFile, $yamlString);
114 }
catch (\Exception $e) {
138 $yamlString = VendorYaml::dump(
$var, $inline, $indent);
139 $ret = empty($yamlString) ?
false :
"<?php\n/*\n---\n" . $yamlString .
"\n...\n*/\n";
140 }
catch (\Exception $e) {
163 $matched = preg_match(
'/(---.*\.\.\.)/s', $yamlString, $match);
164 $unwrapped = $matched ? $match[1] : $yamlString;
165 $ret = VendorYaml::parse($unwrapped);
166 }
catch (\Exception $e) {
188 $yamlString = file_get_contents($yamlFile);
189 $ret = self::loadWrapped($yamlString);
190 }
catch (\Exception $e) {
215 $yamlString = self::dumpWrapped(
$var, $inline, $indent);
216 $ret = file_put_contents($yamlFile, $yamlString);
217 }
catch (\Exception $e) {
static dump($var, $inline=4, $indent=4)
static loadWrapped($yamlString)
static dumpWrapped($var, $inline=4, $indent=4)
static readWrapped($yamlFile)
static save($var, $yamlFile, $inline=4, $indent=4)
static saveWrapped($var, $yamlFile, $inline=4, $indent=4)