[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
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 = array(); 27 private $options = array(); 28 private $defaults = array(); 29 private $host; 30 private $methods = array(); 31 private $schemes = array(); 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, \get_class($this))); 50 } 51 $this->$method($value); 52 } 53 } 54 55 /** 56 * @deprecated since version 2.2, to be removed in 3.0. Use setPath instead. 57 */ 58 public function setPattern($pattern) 59 { 60 @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.2 and will be removed in 3.0. Use the setPath() method instead and use the "path" option instead of the "pattern" option in the route definition.', E_USER_DEPRECATED); 61 62 $this->path = $pattern; 63 } 64 65 /** 66 * @deprecated since version 2.2, to be removed in 3.0. Use getPath instead. 67 */ 68 public function getPattern() 69 { 70 @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.2 and will be removed in 3.0. Use the getPath() method instead and use the "path" option instead of the "pattern" option in the route definition.', E_USER_DEPRECATED); 71 72 return $this->path; 73 } 74 75 public function setPath($path) 76 { 77 $this->path = $path; 78 } 79 80 public function getPath() 81 { 82 return $this->path; 83 } 84 85 public function setHost($pattern) 86 { 87 $this->host = $pattern; 88 } 89 90 public function getHost() 91 { 92 return $this->host; 93 } 94 95 public function setName($name) 96 { 97 $this->name = $name; 98 } 99 100 public function getName() 101 { 102 return $this->name; 103 } 104 105 public function setRequirements($requirements) 106 { 107 if (isset($requirements['_method'])) { 108 if (0 === \count($this->methods)) { 109 $this->methods = explode('|', $requirements['_method']); 110 } 111 112 @trigger_error('The "_method" requirement is deprecated since Symfony 2.2 and will be removed in 3.0. Use the "methods" option instead.', E_USER_DEPRECATED); 113 } 114 115 if (isset($requirements['_scheme'])) { 116 if (0 === \count($this->schemes)) { 117 $this->schemes = explode('|', $requirements['_scheme']); 118 } 119 120 @trigger_error('The "_scheme" requirement is deprecated since Symfony 2.2 and will be removed in 3.0. Use the "schemes" option instead.', E_USER_DEPRECATED); 121 } 122 123 $this->requirements = $requirements; 124 } 125 126 public function getRequirements() 127 { 128 return $this->requirements; 129 } 130 131 public function setOptions($options) 132 { 133 $this->options = $options; 134 } 135 136 public function getOptions() 137 { 138 return $this->options; 139 } 140 141 public function setDefaults($defaults) 142 { 143 $this->defaults = $defaults; 144 } 145 146 public function getDefaults() 147 { 148 return $this->defaults; 149 } 150 151 public function setSchemes($schemes) 152 { 153 $this->schemes = \is_array($schemes) ? $schemes : array($schemes); 154 } 155 156 public function getSchemes() 157 { 158 return $this->schemes; 159 } 160 161 public function setMethods($methods) 162 { 163 $this->methods = \is_array($methods) ? $methods : array($methods); 164 } 165 166 public function getMethods() 167 { 168 return $this->methods; 169 } 170 171 public function setCondition($condition) 172 { 173 $this->condition = $condition; 174 } 175 176 public function getCondition() 177 { 178 return $this->condition; 179 } 180 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |