protected function execute(InputInterface $input, OutputInterface $output) { $documentation = Parser\Raml::fromFile($input->getArgument('file'), $input->getArgument('path')); switch ($input->getArgument('format')) { case 'serialize': $output->write(serialize($documentation)); break; case 'php': default: $output->write(var_export($documentation, true)); break; } }
public static function fromFile($file, $path) { if (!empty($file) && is_file($file)) { $basePath = pathinfo($file, PATHINFO_DIRNAME); $parser = new Raml($basePath); return $parser->parse(file_get_contents($file), $path); } else { throw new RuntimeException('Could not load raml schema ' . $file); } }
public function getDocumentation() { return Parser\Raml::fromFile(__DIR__ . '/../../Resource/property.raml', $this->context->get(Context::KEY_PATH)); }
/** * @expectedException \RuntimeException */ public function testFromFileNotExistingFile() { Raml::fromFile(__DIR__ . '/foo.raml', '/bar/:bar_id'); }