‪TYPO3CMS  ‪main
Route.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
23 class ‪Route
24 {
28  protected ‪$path = '/';
29 
30  protected array ‪$methods = [];
31 
35  protected ‪$options = [];
36 
43  public function ‪__construct(‪$path, ‪$options)
44  {
46  }
47 
53  public function ‪getPath()
54  {
55  return ‪$this->path;
56  }
57 
68  public function ‪setPath($pattern)
69  {
70  $this->path = '/' . ltrim(trim($pattern), '/');
71  return $this;
72  }
73 
80  public function ‪getMethods(): array
81  {
82  return ‪$this->methods;
83  }
84 
93  public function ‪setMethods(array ‪$methods): self
94  {
95  $this->methods = array_map(strtoupper(...), ‪$methods);
96  return $this;
97  }
98 
104  public function ‪getOptions()
105  {
106  return ‪$this->options;
107  }
108 
117  public function ‪setOptions(array ‪$options)
118  {
119  $this->options = ‪$options;
120  return $this;
121  }
122 
132  public function ‪setOption($name, $value)
133  {
134  $this->options[$name] = $value;
135  return $this;
136  }
137 
144  public function ‪getOption($name)
145  {
146  return $this->options[$name] ?? null;
147  }
148 
155  public function ‪hasOption($name)
156  {
157  return array_key_exists($name, $this->options);
158  }
159 }
‪TYPO3\CMS\Backend\Routing\Route\setOptions
‪Route setOptions(array $options)
Definition: Route.php:115
‪TYPO3\CMS\Backend\Routing\Route\getPath
‪string getPath()
Definition: Route.php:51
‪TYPO3\CMS\Backend\Routing\Route\getOption
‪mixed getOption($name)
Definition: Route.php:142
‪TYPO3\CMS\Backend\Routing\Route\$options
‪array $options
Definition: Route.php:33
‪TYPO3\CMS\Backend\Routing\Route\getOptions
‪array getOptions()
Definition: Route.php:102
‪TYPO3\CMS\Backend\Routing\Route
Definition: Route.php:24
‪TYPO3\CMS\Backend\Routing\Route\setPath
‪Route setPath($pattern)
Definition: Route.php:66
‪TYPO3\CMS\Backend\Routing\Route\$path
‪string $path
Definition: Route.php:27
‪TYPO3\CMS\Backend\Routing\Route\__construct
‪__construct($path, $options)
Definition: Route.php:41
‪TYPO3\CMS\Backend\Routing\Route\hasOption
‪bool hasOption($name)
Definition: Route.php:153
‪TYPO3\CMS\Backend\Routing\Route\$methods
‪array $methods
Definition: Route.php:29
‪TYPO3\CMS\Backend\Routing\Route\getMethods
‪string[] getMethods()
Definition: Route.php:78
‪TYPO3\CMS\Backend\Routing\Route\setMethods
‪setMethods(array $methods)
Definition: Route.php:91
‪TYPO3\CMS\Backend\Routing\Route\setOption
‪Route setOption($name, $value)
Definition: Route.php:130
‪TYPO3\CMS\Backend\Routing