2 if (!defined('_ECRIRE_INC_VERSION')) {
6 function yaml_sfyaml_encode($struct, $opt = array()) {
7 require_once _DIR_PLUGIN_YAML
.'sfyaml/sfYaml.php';
8 require_once _DIR_PLUGIN_YAML
.'sfyaml/sfYamlDumper.php';
9 $opt = array_merge(array('inline' => 2), $opt);
10 $yaml = new sfYamlDumper();
11 return $yaml->dump($struct, $opt['inline']);
14 function yaml_sfyaml_decode($input, $show_error = true) {
15 require_once _DIR_PLUGIN_YAML
.'sfyaml/sfYaml.php';
16 require_once _DIR_PLUGIN_YAML
.'sfyaml/sfYamlParser.php';
18 $yaml = new sfYamlParser();
21 $ret = $yaml->parse($input);
22 } catch (Exception
$e) {
24 throw new InvalidArgumentException(sprintf('Unable to parse string: %s', $e->getMessage()));