aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Cinisis.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/classes/Cinisis.php b/classes/Cinisis.php
index 8771b21..915d62f 100644
--- a/classes/Cinisis.php
+++ b/classes/Cinisis.php
@@ -70,7 +70,30 @@ class Cinisis {
}
// Load configuration.
- return Spyc::YAMLLoad($file);
+ return $this->yaml($file);
+ }
+
+ /**
+ * Load YAML into array using backend libraries.
+ *
+ * @param $file
+ * Config file.
+ *
+ * @return
+ * Array with configuration or FALSE if error.
+ */
+ static function yaml($file) {
+ if (file_exists('../contrib/spyc/spyc.php')) {
+ // Use Spyc.
+ include_once '../contrib/spyc/spyc.php';
+ return Spyc::YAMLLoad($file);
+ }
+ elseif (is_callable(array('sfYaml', 'load'))) {
+ // Use symfony built-in yaml loader.
+ return sfYaml::load($file);
+ }
+
+ throw new Exception('No suitable methods for parsing YAML found.');
}
/**