[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/routing/Symfony/Component/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  
  33      /**
  34       * Constructor.
  35       *
  36       * @param array $data An array of key/value parameters.
  37       *
  38       * @throws \BadMethodCallException
  39       */
  40      public function __construct(array $data)
  41      {
  42          $this->requirements = array();
  43          $this->options = array();
  44          $this->defaults = array();
  45          $this->methods = array();
  46          $this->schemes = array();
  47  
  48          if (isset($data['value'])) {
  49              $data['path'] = $data['value'];
  50              unset($data['value']);
  51          }
  52  
  53          foreach ($data as $key => $value) {
  54              $method = 'set'.str_replace('_', '', $key);
  55              if (!method_exists($this, $method)) {
  56                  throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
  57              }
  58              $this->$method($value);
  59          }
  60      }
  61  
  62      /**
  63       * @deprecated Deprecated in 2.2, to be removed in 3.0. Use setPath instead.
  64       */
  65      public function setPattern($pattern)
  66      {
  67          $this->path = $pattern;
  68      }
  69  
  70      /**
  71       * @deprecated Deprecated in 2.2, to be removed in 3.0. Use getPath instead.
  72       */
  73      public function getPattern()
  74      {
  75          return $this->path;
  76      }
  77  
  78      public function setPath($path)
  79      {
  80          $this->path = $path;
  81      }
  82  
  83      public function getPath()
  84      {
  85          return $this->path;
  86      }
  87  
  88      public function setHost($pattern)
  89      {
  90          $this->host = $pattern;
  91      }
  92  
  93      public function getHost()
  94      {
  95          return $this->host;
  96      }
  97  
  98      public function setName($name)
  99      {
 100          $this->name = $name;
 101      }
 102  
 103      public function getName()
 104      {
 105          return $this->name;
 106      }
 107  
 108      public function setRequirements($requirements)
 109      {
 110          $this->requirements = $requirements;
 111      }
 112  
 113      public function getRequirements()
 114      {
 115          return $this->requirements;
 116      }
 117  
 118      public function setOptions($options)
 119      {
 120          $this->options = $options;
 121      }
 122  
 123      public function getOptions()
 124      {
 125          return $this->options;
 126      }
 127  
 128      public function setDefaults($defaults)
 129      {
 130          $this->defaults = $defaults;
 131      }
 132  
 133      public function getDefaults()
 134      {
 135          return $this->defaults;
 136      }
 137  
 138      public function setSchemes($schemes)
 139      {
 140          $this->schemes = is_array($schemes) ? $schemes : array($schemes);
 141      }
 142  
 143      public function getSchemes()
 144      {
 145          return $this->schemes;
 146      }
 147  
 148      public function setMethods($methods)
 149      {
 150          $this->methods = is_array($methods) ? $methods : array($methods);
 151      }
 152  
 153      public function getMethods()
 154      {
 155          return $this->methods;
 156      }
 157  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1