[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/routing/Annotation/ -> Route.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\Annotation;
  13  
  14  /**
  15   * Annotation class for @Route().
  16   *
  17   * @Annotation
  18   * @Target({"CLASS", "METHOD"})
  19   *
  20   * @author Fabien Potencier <fabien@symfony.com>
  21   */
  22  class Route
  23  {
  24      private $path;
  25      private $name;
  26      private $requirements = [];
  27      private $options = [];
  28      private $defaults = [];
  29      private $host;
  30      private $methods = [];
  31      private $schemes = [];
  32      private $condition;
  33  
  34      /**
  35       * @param array $data An array of key/value parameters
  36       *
  37       * @throws \BadMethodCallException
  38       */
  39      public function __construct(array $data)
  40      {
  41          if (isset($data['value'])) {
  42              $data['path'] = $data['value'];
  43              unset($data['value']);
  44          }
  45  
  46          foreach ($data as $key => $value) {
  47              $method = 'set'.str_replace('_', '', $key);
  48              if (!method_exists($this, $method)) {
  49                  throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class));
  50              }
  51              $this->$method($value);
  52          }
  53      }
  54  
  55      public function setPath($path)
  56      {
  57          $this->path = $path;
  58      }
  59  
  60      public function getPath()
  61      {
  62          return $this->path;
  63      }
  64  
  65      public function setHost($pattern)
  66      {
  67          $this->host = $pattern;
  68      }
  69  
  70      public function getHost()
  71      {
  72          return $this->host;
  73      }
  74  
  75      public function setName($name)
  76      {
  77          $this->name = $name;
  78      }
  79  
  80      public function getName()
  81      {
  82          return $this->name;
  83      }
  84  
  85      public function setRequirements($requirements)
  86      {
  87          $this->requirements = $requirements;
  88      }
  89  
  90      public function getRequirements()
  91      {
  92          return $this->requirements;
  93      }
  94  
  95      public function setOptions($options)
  96      {
  97          $this->options = $options;
  98      }
  99  
 100      public function getOptions()
 101      {
 102          return $this->options;
 103      }
 104  
 105      public function setDefaults($defaults)
 106      {
 107          $this->defaults = $defaults;
 108      }
 109  
 110      public function getDefaults()
 111      {
 112          return $this->defaults;
 113      }
 114  
 115      public function setSchemes($schemes)
 116      {
 117          $this->schemes = \is_array($schemes) ? $schemes : [$schemes];
 118      }
 119  
 120      public function getSchemes()
 121      {
 122          return $this->schemes;
 123      }
 124  
 125      public function setMethods($methods)
 126      {
 127          $this->methods = \is_array($methods) ? $methods : [$methods];
 128      }
 129  
 130      public function getMethods()
 131      {
 132          return $this->methods;
 133      }
 134  
 135      public function setCondition($condition)
 136      {
 137          $this->condition = $condition;
 138      }
 139  
 140      public function getCondition()
 141      {
 142          return $this->condition;
 143      }
 144  }


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