| @@ 107-117 (lines=11) @@ | ||
| 104 | * |
|
| 105 | * @return integer|boolean number of bytes written, or false on error |
|
| 106 | */ |
|
| 107 | public static function save($var, $yamlFile, $inline = 4, $indent = 4) |
|
| 108 | { |
|
| 109 | try { |
|
| 110 | $yamlString = VendorYaml::dump($var, $inline, $indent); |
|
| 111 | $ret = file_put_contents($yamlFile, $yamlString); |
|
| 112 | } catch (\Exception $e) { |
|
| 113 | static::logError($e); |
|
| 114 | $ret = false; |
|
| 115 | } |
|
| 116 | return $ret; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Dump an PHP array as a YAML string with a php wrapper |
|
| @@ 223-233 (lines=11) @@ | ||
| 220 | * |
|
| 221 | * @return integer|boolean number of bytes written, or false on error |
|
| 222 | */ |
|
| 223 | public static function saveWrapped($var, $yamlFile, $inline = 4, $indent = 4) |
|
| 224 | { |
|
| 225 | try { |
|
| 226 | $yamlString = static::dumpWrapped($var, $inline, $indent); |
|
| 227 | $ret = file_put_contents($yamlFile, $yamlString); |
|
| 228 | } catch (\Exception $e) { |
|
| 229 | static::logError($e); |
|
| 230 | $ret = false; |
|
| 231 | } |
|
| 232 | return $ret; |
|
| 233 | } |
|
| 234 | ||
| 235 | /** |
|
| 236 | * @param \Exception $e throwable to log |
|