vendor/nelmio/api-doc-bundle/src/NelmioApiDocBundle.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the NelmioApiDocBundle package.
  4. *
  5. * (c) Nelmio
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Nelmio\ApiDocBundle;
  11. use Nelmio\ApiDocBundle\DependencyInjection\Compiler\ConfigurationPass;
  12. use Nelmio\ApiDocBundle\DependencyInjection\Compiler\CustomProcessorPass;
  13. use Nelmio\ApiDocBundle\DependencyInjection\Compiler\PhpDocExtractorPass;
  14. use Nelmio\ApiDocBundle\DependencyInjection\Compiler\TagDescribersPass;
  15. use Symfony\Component\DependencyInjection\ContainerBuilder;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. final class NelmioApiDocBundle extends Bundle
  18. {
  19. public function build(ContainerBuilder $container): void
  20. {
  21. $container->addCompilerPass(new ConfigurationPass());
  22. $container->addCompilerPass(new TagDescribersPass());
  23. $container->addCompilerPass(new PhpDocExtractorPass());
  24. $container->addCompilerPass(new CustomProcessorPass());
  25. }
  26. /**
  27. * Allows using the new directory structure on Symfony < 6.1.
  28. * Without this no proper namespace is set for twig templates.
  29. *
  30. * @see \Symfony\Component\HttpKernel\Bundle\AbstractBundle::getPath()
  31. */
  32. public function getPath(): string
  33. {
  34. if (!isset($this->path)) {
  35. $reflected = new \ReflectionObject($this);
  36. // assume the modern directory structure by default
  37. $this->path = \dirname($reflected->getFileName(), 2);
  38. }
  39. return $this->path;
  40. }
  41. }