/** * @param string $path * @return \Raml\Resource * @throws ValidatorSchemaException */ private function getResource($path) { try { return $this->apiDefinition->getResourceByUri($path); } catch (ResourceNotFoundException $exception) { $message = sprintf('Schema for URI %s was not found in API definition', $path); throw new ValidatorSchemaException($message, 0, $exception); } }
/** * @param string $path * * @throw Symfony\Component\HttpKernel\Exception\NotFoundHttpException * * @return \Raml\Resource|false */ protected function getResourceFromPath($path) { try { $resource = $this->apiDefinition->getResourceByUri($path); } catch (ResourceNotFoundException $e) { //Try with a trailing slash to accept /resource/ and /ressource try { $resource = $this->apiDefinition->getResourceByUri($path . '/'); } catch (ResourceNotFoundException $e) { throw new NotFoundHttpException($e->getMessage()); } } return $resource; }