PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/protected/extensions/doctrine/vendors/Symfony/Component/Routing/Annotation/Route.php

https://bitbucket.org/NordLabs/yiidoctrine
PHP | 103 lines | 67 code | 16 blank | 20 comment | 2 complexity | 3906b427e4fb82f6c06da371218ed5da MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.1, BSD-3-Clause
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Routing\Annotation;
  11. /**
  12. * Annotation class for @Route().
  13. *
  14. * @Annotation
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. class Route
  19. {
  20. private $pattern;
  21. private $name;
  22. private $requirements;
  23. private $options;
  24. private $defaults;
  25. /**
  26. * Constructor.
  27. *
  28. * @param array $data An array of key/value parameters.
  29. */
  30. public function __construct(array $data)
  31. {
  32. $this->requirements = array();
  33. $this->options = array();
  34. $this->defaults = array();
  35. if (isset($data['value'])) {
  36. $data['pattern'] = $data['value'];
  37. unset($data['value']);
  38. }
  39. foreach ($data as $key => $value) {
  40. $method = 'set'.$key;
  41. if (!method_exists($this, $method)) {
  42. throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this)));
  43. }
  44. $this->$method($value);
  45. }
  46. }
  47. public function setPattern($pattern)
  48. {
  49. $this->pattern = $pattern;
  50. }
  51. public function getPattern()
  52. {
  53. return $this->pattern;
  54. }
  55. public function setName($name)
  56. {
  57. $this->name = $name;
  58. }
  59. public function getName()
  60. {
  61. return $this->name;
  62. }
  63. public function setRequirements($requirements)
  64. {
  65. $this->requirements = $requirements;
  66. }
  67. public function getRequirements()
  68. {
  69. return $this->requirements;
  70. }
  71. public function setOptions($options)
  72. {
  73. $this->options = $options;
  74. }
  75. public function getOptions()
  76. {
  77. return $this->options;
  78. }
  79. public function setDefaults($defaults)
  80. {
  81. $this->defaults = $defaults;
  82. }
  83. public function getDefaults()
  84. {
  85. return $this->defaults;
  86. }
  87. }