|
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
|
|
|
|
|
18
|
|
|
namespace TYPO3\CMS\Extbase\Http; |
|
19
|
|
|
|
|
20
|
|
|
use TYPO3\CMS\Core\Http\Response; |
|
21
|
|
|
use TYPO3\CMS\Extbase\Error\Result; |
|
22
|
|
|
|
|
23
|
|
|
class ForwardResponse extends Response |
|
24
|
|
|
{ |
|
25
|
|
|
private string $actionName; |
|
26
|
|
|
private ?string $controllerName = null; |
|
27
|
|
|
private ?string $extensionName = null; |
|
28
|
|
|
private array $arguments = []; |
|
29
|
|
|
private Result $argumentsValidationResult; |
|
30
|
|
|
|
|
31
|
|
|
public function __construct(string $actionName) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->actionName = $actionName; |
|
34
|
|
|
$this->argumentsValidationResult = new Result(); |
|
35
|
|
|
parent::__construct('php://temp', 204); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function withControllerName(string $controllerName): self |
|
39
|
|
|
{ |
|
40
|
|
|
$clone = clone $this; |
|
41
|
|
|
$clone->controllerName = $controllerName; |
|
42
|
|
|
return $clone; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function withoutControllerName(): self |
|
46
|
|
|
{ |
|
47
|
|
|
$clone = clone $this; |
|
48
|
|
|
$clone->controllerName = null; |
|
49
|
|
|
return $clone; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function withExtensionName(string $extensionName): self |
|
53
|
|
|
{ |
|
54
|
|
|
$clone = clone $this; |
|
55
|
|
|
$clone->extensionName = $extensionName; |
|
56
|
|
|
return $clone; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function withoutExtensionName(): self |
|
60
|
|
|
{ |
|
61
|
|
|
$clone = clone $this; |
|
62
|
|
|
$this->extensionName = null; |
|
63
|
|
|
return $clone; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function withArguments(array $arguments): self |
|
67
|
|
|
{ |
|
68
|
|
|
$clone = clone $this; |
|
69
|
|
|
$clone->arguments = $arguments; |
|
70
|
|
|
return $clone; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function withoutArguments(): self |
|
74
|
|
|
{ |
|
75
|
|
|
$clone = clone $this; |
|
76
|
|
|
$this->arguments = []; |
|
77
|
|
|
return $clone; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function withArgumentsValidationResult(Result $argumentsValidationResult): self |
|
81
|
|
|
{ |
|
82
|
|
|
$clone = clone $this; |
|
83
|
|
|
$clone->argumentsValidationResult = $argumentsValidationResult; |
|
84
|
|
|
return $clone; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function getActionName(): string |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->actionName; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getControllerName(): ?string |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->controllerName; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getExtensionName(): ?string |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->extensionName; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function getArguments(): array |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->arguments; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function getArgumentsValidationResult(): Result |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->argumentsValidationResult; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|