TYPO3  7.6
Route.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Routing;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 class Route
23 {
27  protected $path = '/';
28 
32  protected $options = array();
33 
40  public function __construct($path, $options)
41  {
42  $this->setPath($path)->setOptions($options);
43  }
44 
50  public function getPath()
51  {
52  return $this->path;
53  }
54 
65  public function setPath($pattern)
66  {
67  $this->path = '/' . ltrim(trim($pattern), '/');
68  return $this;
69  }
70 
76  public function getOptions()
77  {
78  return $this->options;
79  }
80 
89  public function setOptions(array $options)
90  {
91  $this->options = $options;
92  return $this;
93  }
94 
104  public function setOption($name, $value)
105  {
106  $this->options[$name] = $value;
107  return $this;
108  }
109 
116  public function getOption($name)
117  {
118  return isset($this->options[$name]) ? $this->options[$name] : null;
119  }
120 
127  public function hasOption($name)
128  {
129  return array_key_exists($name, $this->options);
130  }
131 }