public function dump(Definition $definition, string $filepath) { $file = new SplFileInfo($filepath); if ($file->isDir() || !$file->isWritable()) { throw new RuntimeException("Given file {$filepath} is directory or is unwritable"); } $definitionHydrator = new DefinitionHydrator(); return yaml_emit_file($file->getPathname(), $definitionHydrator->extract($definition)); }