public static function createFromFile($filename)
{
if (!file_exists($filename)) {
throw new Exception(sprintf('Failed to load yaml from file "%s". The file does not exist', $filename), Exception::BAD_LOADERDATA);
}
//suppres warning with @ operator. we are explicitely testing the return value.
$yaml = @file_get_contents($filename);
if (false === $yaml) {
throw new Exception(sprintf('Failed to read yaml data from file "%s". Unknown error (permissions?)', $filename), Exception::BAD_LOADERDATA);
}
return new static($yaml);
}