/** * Computes the documentation. * * @param Documentation $object * @param array $classes * * @return array */ private function computeDoc(Documentation $object, array $classes) : array { $doc = ['@context' => $this->getContext(), '@id' => $this->urlGenerator->generate('api_doc', ['_format' => self::FORMAT])]; if ('' !== $object->getTitle()) { $doc['hydra:title'] = $object->getTitle(); } if ('' !== $object->getDescription()) { $doc['hydra:description'] = $object->getDescription(); } $doc['hydra:entrypoint'] = $this->urlGenerator->generate('api_entrypoint'); $doc['hydra:supportedClass'] = $classes; return $doc; }
/** * Computes the Swagger documentation. * * @param Documentation $documentation * @param \ArrayObject $definitions * @param \ArrayObject $paths * * @return array */ private function computeDoc(Documentation $documentation, \ArrayObject $definitions, \ArrayObject $paths) : array { $doc = ['swagger' => self::SWAGGER_VERSION, 'basePath' => $this->urlGenerator->generate('api_entrypoint'), 'info' => ['title' => $documentation->getTitle(), 'version' => $documentation->getVersion()], 'paths' => $paths]; if ('' !== ($description = $documentation->getDescription())) { $doc['info']['description'] = $description; } if (count($definitions) > 0) { $doc['definitions'] = $definitions; } return $doc; }