‪TYPO3CMS  11.5
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 
94  public function ‪setMethods(array ‪$methods): self
95  {
96  $this->methods = array_map('strtoupper', ‪$methods);
97  return $this;
98  }
99 
105  public function ‪getOptions()
106  {
107  return ‪$this->options;
108  }
109 
118  public function ‪setOptions(array ‪$options)
119  {
120  $this->options = ‪$options;
121  return $this;
122  }
123 
133  public function ‪setOption($name, $value)
134  {
135  $this->options[$name] = $value;
136  return $this;
137  }
138 
145  public function ‪getOption($name)
146  {
147  return $this->options[$name] ?? null;
148  }
149 
156  public function ‪hasOption($name)
157  {
158  return array_key_exists($name, $this->options);
159  }
160 }
‪TYPO3\CMS\Backend\Routing\Route\setOptions
‪Route setOptions(array $options)
Definition: Route.php:116
‪TYPO3\CMS\Backend\Routing\Route\getPath
‪string getPath()
Definition: Route.php:51
‪TYPO3\CMS\Backend\Routing\Route\getOption
‪mixed getOption($name)
Definition: Route.php:143
‪TYPO3\CMS\Backend\Routing\Route\$options
‪array $options
Definition: Route.php:33
‪TYPO3\CMS\Backend\Routing\Route\getOptions
‪array getOptions()
Definition: Route.php:103
‪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:154
‪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
‪self setMethods(array $methods)
Definition: Route.php:92
‪TYPO3\CMS\Backend\Routing\Route\setOption
‪Route setOption($name, $value)
Definition: Route.php:131
‪TYPO3\CMS\Backend\Routing