[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/twig-bridge/Extension/ -> LogoutUrlExtension.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Bridge\Twig\Extension;
  13  
  14  use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
  15  use Twig\Extension\AbstractExtension;
  16  use Twig\TwigFunction;
  17  
  18  /**
  19   * LogoutUrlHelper provides generator functions for the logout URL to Twig.
  20   *
  21   * @author Jeremy Mikola <jmikola@gmail.com>
  22   */
  23  class LogoutUrlExtension extends AbstractExtension
  24  {
  25      private $generator;
  26  
  27      public function __construct(LogoutUrlGenerator $generator)
  28      {
  29          $this->generator = $generator;
  30      }
  31  
  32      /**
  33       * {@inheritdoc}
  34       */
  35      public function getFunctions()
  36      {
  37          return [
  38              new TwigFunction('logout_url', [$this, 'getLogoutUrl']),
  39              new TwigFunction('logout_path', [$this, 'getLogoutPath']),
  40          ];
  41      }
  42  
  43      /**
  44       * Generates the relative logout URL for the firewall.
  45       *
  46       * @param string|null $key The firewall key or null to use the current firewall key
  47       *
  48       * @return string The relative logout URL
  49       */
  50      public function getLogoutPath($key = null)
  51      {
  52          return $this->generator->getLogoutPath($key);
  53      }
  54  
  55      /**
  56       * Generates the absolute logout URL for the firewall.
  57       *
  58       * @param string|null $key The firewall key or null to use the current firewall key
  59       *
  60       * @return string The absolute logout URL
  61       */
  62      public function getLogoutUrl($key = null)
  63      {
  64          return $this->generator->getLogoutUrl($key);
  65      }
  66  
  67      /**
  68       * {@inheritdoc}
  69       */
  70      public function getName()
  71      {
  72          return 'logout_url';
  73      }
  74  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1