ForwardResponse.php 2.66 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

declare(strict_types=1);

/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

namespace TYPO3\CMS\Extbase\Http;

use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Extbase\Error\Result;

class ForwardResponse extends Response
{
    private string $actionName;
    private ?string $controllerName = null;
    private ?string $extensionName = null;
28
    private ?array $arguments = null;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    private Result $argumentsValidationResult;

    public function __construct(string $actionName)
    {
        $this->actionName = $actionName;
        $this->argumentsValidationResult = new Result();
        parent::__construct('php://temp', 204);
    }

    public function withControllerName(string $controllerName): self
    {
        $clone = clone $this;
        $clone->controllerName = $controllerName;
        return $clone;
    }

    public function withoutControllerName(): self
    {
        $clone = clone $this;
        $clone->controllerName = null;
        return $clone;
    }

    public function withExtensionName(string $extensionName): self
    {
        $clone = clone $this;
        $clone->extensionName = $extensionName;
        return $clone;
    }

    public function withoutExtensionName(): self
    {
        $clone = clone $this;
        $this->extensionName = null;
        return $clone;
    }

    public function withArguments(array $arguments): self
    {
        $clone = clone $this;
        $clone->arguments = $arguments;
        return $clone;
    }

    public function withoutArguments(): self
    {
        $clone = clone $this;
76
        $this->arguments = null;
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        return $clone;
    }

    public function withArgumentsValidationResult(Result $argumentsValidationResult): self
    {
        $clone = clone $this;
        $clone->argumentsValidationResult = $argumentsValidationResult;
        return $clone;
    }

    public function getActionName(): string
    {
        return $this->actionName;
    }

    public function getControllerName(): ?string
    {
        return $this->controllerName;
    }

    public function getExtensionName(): ?string
    {
        return $this->extensionName;
    }

102
    public function getArguments(): ?array
103
104
105
106
107
108
109
110
111
    {
        return $this->arguments;
    }

    public function getArgumentsValidationResult(): Result
    {
        return $this->argumentsValidationResult;
    }
}