[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/routing/Loader/Configurator/Traits/ -> AddTrait.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\Loader\Configurator\RouteConfigurator;
  15  use Symfony\Component\Routing\Route;
  16  use Symfony\Component\Routing\RouteCollection;
  17  
  18  trait AddTrait
  19  {
  20      /**
  21       * @var RouteCollection
  22       */
  23      private $collection;
  24  
  25      private $name = '';
  26  
  27      /**
  28       * Adds a route.
  29       *
  30       * @param string $name
  31       * @param string $path
  32       *
  33       * @return RouteConfigurator
  34       */
  35      final public function add($name, $path)
  36      {
  37          $parentConfigurator = $this instanceof RouteConfigurator ? $this->parentConfigurator : null;
  38          $this->collection->add($this->name.$name, $route = new Route($path));
  39  
  40          return new RouteConfigurator($this->collection, $route, '', $parentConfigurator);
  41      }
  42  
  43      /**
  44       * Adds a route.
  45       *
  46       * @param string $name
  47       * @param string $path
  48       *
  49       * @return RouteConfigurator
  50       */
  51      final public function __invoke($name, $path)
  52      {
  53          return $this->add($name, $path);
  54      }
  55  }


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