You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
765 B
41 lines
765 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace Fuel\Core;
|
||
|
|
||
|
/**
|
||
|
* Yaml Lang file parser
|
||
|
*/
|
||
|
class Lang_Yml extends \Lang_File
|
||
|
{
|
||
|
protected $ext = '.yml';
|
||
|
|
||
|
/**
|
||
|
* Loads in the given file and parses it.
|
||
|
*
|
||
|
* @param string $file File to load
|
||
|
* @return array
|
||
|
*/
|
||
|
protected function load_file($file)
|
||
|
{
|
||
|
$contents = $this->parse_vars(file_get_contents($file));
|
||
|
return \Format::forge($contents, 'yaml')->to_array();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Returns the formatted language file contents.
|
||
|
*
|
||
|
* @param array $contents config array
|
||
|
* @return string formatted config file contents
|
||
|
*/
|
||
|
protected function export_format($contents)
|
||
|
{
|
||
|
if ( ! function_exists('spyc_load'))
|
||
|
{
|
||
|
import('spyc/spyc', 'vendor');
|
||
|
}
|
||
|
|
||
|
$this->prep_vars($contents);
|
||
|
return \Spyc::YAMLDump($contents);
|
||
|
}
|
||
|
}
|