Exemplo n.º 1
0
 /**
  * Initializes holder with yaml string OR file.
  *
  * @param string $yaml Yaml string or file path
  */
 public function __construct($yaml)
 {
     // Handle filename explicitly for BC reasons, as Symfony Yaml 3.0 does not do it anymore
     $file = null;
     if (strpos($yaml, "\n") === false && is_file($yaml)) {
         if (false === is_readable($yaml)) {
             throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $yaml));
         }
         $file = $yaml;
         $yaml = file_get_contents($file);
     }
     try {
         $content = Yaml::parse($yaml);
     } catch (ParseException $e) {
         if ($file) {
             $e->setParsedFile($file);
         }
         throw $e;
     }
     parent::__construct($content);
 }
 /**
  * Initializes holder with yaml string OR file.
  *
  * @param string $yaml Yaml string
  */
 public function __construct($yaml)
 {
     parent::__construct(Yaml::parse($yaml));
 }