| @@ 109-119 (lines=11) @@ | ||
| 106 | * |
|
| 107 | * @return integer|boolean number of bytes written, or false on error |
|
| 108 | */ |
|
| 109 | public static function save($var, $yamlFile, $inline = 4, $indent = 4) |
|
| 110 | { |
|
| 111 | try { |
|
| 112 | $yamlString = VendorYaml::dump($var, $inline, $indent); |
|
| 113 | $ret = file_put_contents($yamlFile, $yamlString); |
|
| 114 | } catch (\Exception $e) { |
|
| 115 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
| 116 | $ret = false; |
|
| 117 | } |
|
| 118 | return $ret; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Dump an PHP array as a YAML string with a php wrapper |
|
| @@ 212-222 (lines=11) @@ | ||
| 209 | * |
|
| 210 | * @return integer|boolean number of bytes written, or false on error |
|
| 211 | */ |
|
| 212 | public static function saveWrapped($var, $yamlFile, $inline = 4, $indent = 4) |
|
| 213 | { |
|
| 214 | try { |
|
| 215 | $yamlString = self::dumpWrapped($var, $inline, $indent); |
|
| 216 | $ret = file_put_contents($yamlFile, $yamlString); |
|
| 217 | } catch (\Exception $e) { |
|
| 218 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
| 219 | $ret = false; |
|
| 220 | } |
|
| 221 | return $ret; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | ||