‪TYPO3CMS  ‪main
RouteResult.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
27 {
28  public function ‪__construct(
29  protected ‪Route $route,
30  protected array $arguments = [],
31  ) {}
32 
33  public function ‪getRoute(): ‪Route
34  {
35  return $this->route;
36  }
37 
38  public function ‪getRouteName(): string
39  {
40  return $this->route->getOption('_identifier');
41  }
42 
43  public function ‪getArguments(): array
44  {
45  return $this->arguments;
46  }
47 
48  public function ‪offsetExists($offset): bool
49  {
50  return $offset === 'route' || isset($this->arguments[$offset]);
51  }
52 
53  public function ‪offsetGet(mixed $offset): mixed
54  {
55  return match ($offset) {
56  'route' => $this->route,
57  default => $this->arguments[$offset],
58  };
59  }
60 
61  public function ‪offsetSet(mixed $offset = '', mixed $value = ''): void
62  {
63  switch ($offset) {
64  case 'route':
65  $this->route = $value;
66  break;
67  default:
68  $this->arguments[$offset] = $value;
69  }
70  }
71 
72  public function ‪offsetUnset(mixed $offset): void
73  {
74  switch ($offset) {
75  case 'route':
76  throw new \InvalidArgumentException('You can never unset the Route in a route result', 1669839336);
77  default:
78  unset($this->arguments[$offset]);
79  }
80  }
81 }
‪TYPO3\CMS\Core\Routing\RouteResultInterface
Definition: RouteResultInterface.php:23
‪TYPO3\CMS\Backend\Routing\RouteResult\offsetSet
‪offsetSet(mixed $offset='', mixed $value='')
Definition: RouteResult.php:61
‪TYPO3\CMS\Backend\Routing\RouteResult\__construct
‪__construct(protected Route $route, protected array $arguments=[],)
Definition: RouteResult.php:28
‪TYPO3\CMS\Backend\Routing\RouteResult\offsetGet
‪offsetGet(mixed $offset)
Definition: RouteResult.php:53
‪TYPO3\CMS\Backend\Routing\Route
Definition: Route.php:24
‪TYPO3\CMS\Backend\Routing\RouteResult
Definition: RouteResult.php:27
‪TYPO3\CMS\Backend\Routing\RouteResult\getRoute
‪getRoute()
Definition: RouteResult.php:33
‪TYPO3\CMS\Backend\Routing\RouteResult\offsetExists
‪offsetExists($offset)
Definition: RouteResult.php:48
‪TYPO3\CMS\Backend\Routing\RouteResult\getRouteName
‪getRouteName()
Definition: RouteResult.php:38
‪TYPO3\CMS\Backend\Routing
‪TYPO3\CMS\Backend\Routing\RouteResult\offsetUnset
‪offsetUnset(mixed $offset)
Definition: RouteResult.php:72
‪TYPO3\CMS\Backend\Routing\RouteResult\getArguments
‪getArguments()
Definition: RouteResult.php:43