[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/routing/Loader/Configurator/Traits/ -> RouteTrait.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\Component\Routing\Loader\Configurator\Traits;
  13  
  14  use Symfony\Component\Routing\Route;
  15  use Symfony\Component\Routing\RouteCollection;
  16  
  17  trait RouteTrait
  18  {
  19      /**
  20       * @var RouteCollection|Route
  21       */
  22      private $route;
  23  
  24      /**
  25       * Adds defaults.
  26       *
  27       * @return $this
  28       */
  29      final public function defaults(array $defaults)
  30      {
  31          $this->route->addDefaults($defaults);
  32  
  33          return $this;
  34      }
  35  
  36      /**
  37       * Adds requirements.
  38       *
  39       * @return $this
  40       */
  41      final public function requirements(array $requirements)
  42      {
  43          $this->route->addRequirements($requirements);
  44  
  45          return $this;
  46      }
  47  
  48      /**
  49       * Adds options.
  50       *
  51       * @return $this
  52       */
  53      final public function options(array $options)
  54      {
  55          $this->route->addOptions($options);
  56  
  57          return $this;
  58      }
  59  
  60      /**
  61       * Sets the condition.
  62       *
  63       * @param string $condition
  64       *
  65       * @return $this
  66       */
  67      final public function condition($condition)
  68      {
  69          $this->route->setCondition($condition);
  70  
  71          return $this;
  72      }
  73  
  74      /**
  75       * Sets the pattern for the host.
  76       *
  77       * @param string $pattern
  78       *
  79       * @return $this
  80       */
  81      final public function host($pattern)
  82      {
  83          $this->route->setHost($pattern);
  84  
  85          return $this;
  86      }
  87  
  88      /**
  89       * Sets the schemes (e.g. 'https') this route is restricted to.
  90       * So an empty array means that any scheme is allowed.
  91       *
  92       * @param string[] $schemes
  93       *
  94       * @return $this
  95       */
  96      final public function schemes(array $schemes)
  97      {
  98          $this->route->setSchemes($schemes);
  99  
 100          return $this;
 101      }
 102  
 103      /**
 104       * Sets the HTTP methods (e.g. 'POST') this route is restricted to.
 105       * So an empty array means that any method is allowed.
 106       *
 107       * @param string[] $methods
 108       *
 109       * @return $this
 110       */
 111      final public function methods(array $methods)
 112      {
 113          $this->route->setMethods($methods);
 114  
 115          return $this;
 116      }
 117  
 118      /**
 119       * Adds the "_controller" entry to defaults.
 120       *
 121       * @param callable|string $controller a callable or parseable pseudo-callable
 122       *
 123       * @return $this
 124       */
 125      final public function controller($controller)
 126      {
 127          $this->route->addDefaults(['_controller' => $controller]);
 128  
 129          return $this;
 130      }
 131  }


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