* @copyright 2015 PrestaShow.pl * @license http://PrestaShow.pl/license */ use Symfony\Component\Yaml\Yaml; class PShow_Yaml { /** * Send the YAML representation of a value to a file * * @param string $filepath * @param mixed $data * @return boolean */ public static function emitToFile($filepath, $data) { if (function_exists('yaml_emit_file')) { return yaml_emit_file($filepath, $data); } return file_put_contents($filepath, Yaml::dump($data)); } /** * Parse a YAML stream from a file * * @param string $filepath * @return mixed */ public static function parseFile($filepath) { if (function_exists('yaml_parse_file')) { return yaml_parse_file($filepath); } return Yaml::parse(file_get_contents($filepath)); } }