public static function getConfigFile($name) { if (file_exists(BASE_PATH . '/_data/' . $name . '.yaml')) { return Dipper::parse(file_get_contents(BASE_PATH . '/_data/' . $name . '.yaml')); } return false; }
/** * Load the YAML string into an DOMDocument * * @param mixed $source * @param string $contentType * @param array $options * @return Document|NULL */ public function load($source, $contentType, array $options = []) { if ($this->supports($contentType)) { if (FALSE === strpos($source, "\n")) { $source = file_get_contents($source); } $yaml = Dipper::parse($source); if (!empty($yaml) || is_array($yaml)) { $dom = new Document('1.0', 'UTF-8'); $dom->appendChild($root = $dom->createElementNS(self::XMLNS, 'json:json')); $this->transferTo($root, $yaml); return $dom; } } return NULL; }
function yaml_decode($yaml) { if ($yaml[0] == '{') { return json_decode($yaml, true); } return Dipper::parse($yaml); }