src/Controller/DocumentationController.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\RepositoryManager;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class DocumentationController extends AbstractController
  8. {
  9.     private $repositoryManager;
  10.     public function __construct(RepositoryManager $repositoryManager)
  11.     {
  12.         $this->repositoryManager $repositoryManager;
  13.     }
  14.     /**
  15.      * @Route("/docs", name="documentation")
  16.      */
  17.     public function index(): Response
  18.     {
  19.         return $this->render('documentation/index.html.twig', [
  20.             'repositories' => $this->repositoryManager->all(),
  21.         ]);
  22.     }
  23.     /**
  24.      * @Route("/docs/{repository}/{version}/{page}", name="documentation_page", defaults={"page": ""}, requirements={"page": ".+"})
  25.      */
  26.     public function page(string $repositorystring $versionstring $page): Response
  27.     {
  28.         $metadata $this->repositoryManager->repository($repository);
  29.         $page $this->repositoryManager->page($repository$version$page);
  30.         return $this->render('documentation/page.html.twig', [
  31.             'repository' => $repository,
  32.             'repository_data' => $metadata,
  33.             'version' => $version,
  34.             'page' => $page,
  35.         ]);
  36.     }
  37. }