@@ 51-60 (lines=10) @@ | ||
48 | * |
|
49 | * @return string|bool YAML string or false on error |
|
50 | */ |
|
51 | public static function dump($var, $inline = 4, $indent = 4) |
|
52 | { |
|
53 | try { |
|
54 | $ret = VendorYaml::dump($var, $inline, $indent); |
|
55 | } catch (\Exception $e) { |
|
56 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
57 | $ret = false; |
|
58 | } |
|
59 | return $ret; |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * Load a YAML string into a PHP array |
|
@@ 87-97 (lines=11) @@ | ||
84 | * |
|
85 | * @return array|boolean PHP array or false on error |
|
86 | */ |
|
87 | public static function read($yamlFile) |
|
88 | { |
|
89 | try { |
|
90 | $yamlString = file_get_contents($yamlFile); |
|
91 | $ret = VendorYaml::parse($yamlString); |
|
92 | } catch (\Exception $e) { |
|
93 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
94 | $ret = false; |
|
95 | } |
|
96 | return $ret; |
|
97 | } |
|
98 | ||
99 | /** |
|
100 | * Save a PHP array as a YAML file |
|
@@ 185-195 (lines=11) @@ | ||
182 | * |
|
183 | * @return array|boolean PHP array or false on error |
|
184 | */ |
|
185 | public static function readWrapped($yamlFile) |
|
186 | { |
|
187 | try { |
|
188 | $yamlString = file_get_contents($yamlFile); |
|
189 | $ret = self::loadWrapped($yamlString); |
|
190 | } catch (\Exception $e) { |
|
191 | \Xoops::getInstance()->events()->triggerEvent('core.exception', $e); |
|
192 | $ret = false; |
|
193 | } |
|
194 | return $ret; |
|
195 | } |
|
196 | ||
197 | /** |
|
198 | * Save a PHP array as a YAML file with a php wrapper |