예제 #1
0
파일: Toml.php 프로젝트: bruensicke/radium
 public static function file($file)
 {
     if (!file_exists($file)) {
         return array();
     }
     return TomlParser::fromFile($file);
 }
 public function load($filename)
 {
     if (!class_exists('Toml\\Parser')) {
         throw new \RuntimeException('Unable to read toml as the Toml Parser is not installed.');
     }
     $config = Parser::fromFile($filename);
     return $config ?: array();
 }
예제 #3
0
 /**
  * @param string $data
  *
  * @return mixed
  * @throws Exception\TomlThawException
  */
 public function thaw($data)
 {
     try {
         $value = Parser::fromString($data);
     } catch (Exception $e) {
         throw new Exception\TomlThawException($e);
     }
     return $value;
 }
예제 #4
0
 /**
  *
  * @param  string $path
  * @param array $options
  * @return FixtureCollection
  */
 public function load($path, array $options = array())
 {
     $data = Parser::fromFile($path);
     return FixtureCollection::create($data);
 }
예제 #5
0
 public function parse($content)
 {
     return Toml::fromString($content);
 }
예제 #6
0
 /**
  * Deserializes Frontmatter data in the Toml format.
  *
  * @param string $data
  *
  * @return object
  */
 public function deserialize($data)
 {
     return Parser::fromString($data);
 }