[TASK] Streamline PHPDoc comment matches function/method signature
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Mvc / Controller / ControllerContext.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Mvc\Controller;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * The controller context contains information from the controller
19 *
20 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
21 * @api
22 */
23 class ControllerContext
24 {
25 /**
26 * @var \TYPO3\CMS\Extbase\Mvc\Request
27 */
28 protected $request;
29
30 /**
31 * @var \TYPO3\CMS\Extbase\Mvc\Response
32 */
33 protected $response;
34
35 /**
36 * @var \TYPO3\CMS\Extbase\Mvc\Controller\Arguments
37 */
38 protected $arguments;
39
40 /**
41 * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
42 */
43 protected $uriBuilder;
44
45 /**
46 * @var string
47 */
48 protected $flashMessageQueueDefaultIdentifier;
49
50 /**
51 * @var \TYPO3\CMS\Core\Messaging\FlashMessageService
52 */
53 protected $flashMessageService;
54
55 /**
56 * @var \TYPO3\CMS\Extbase\Service\ExtensionService
57 */
58 protected $extensionService;
59
60 /**
61 * @param \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService
62 */
63 public function injectFlashMessageService(\TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService)
64 {
65 $this->flashMessageService = $flashMessageService;
66 }
67
68 /**
69 * @param \TYPO3\CMS\Extbase\Service\ExtensionService $extensionService
70 */
71 public function injectExtensionService(\TYPO3\CMS\Extbase\Service\ExtensionService $extensionService)
72 {
73 $this->extensionService = $extensionService;
74 }
75
76 /**
77 * Set the request of the controller
78 *
79 * @param \TYPO3\CMS\Extbase\Mvc\Request $request
80 */
81 public function setRequest(\TYPO3\CMS\Extbase\Mvc\Request $request)
82 {
83 $this->request = $request;
84 }
85
86 /**
87 * Get the request of the controller
88 *
89 * @return \TYPO3\CMS\Extbase\Mvc\Request
90 * @api
91 */
92 public function getRequest()
93 {
94 return $this->request;
95 }
96
97 /**
98 * Set the response of the controller
99 *
100 * @param \TYPO3\CMS\Extbase\Mvc\Response $response
101 */
102 public function setResponse(\TYPO3\CMS\Extbase\Mvc\Response $response)
103 {
104 $this->response = $response;
105 }
106
107 /**
108 * Get the response of the controller
109 *
110 * @return \TYPO3\CMS\Extbase\Mvc\Response
111 * @api
112 */
113 public function getResponse()
114 {
115 return $this->response;
116 }
117
118 /**
119 * Set the arguments of the controller
120 *
121 * @param \TYPO3\CMS\Extbase\Mvc\Controller\Arguments $arguments
122 */
123 public function setArguments(\TYPO3\CMS\Extbase\Mvc\Controller\Arguments $arguments)
124 {
125 $this->arguments = $arguments;
126 }
127
128 /**
129 * Get the arguments of the controller
130 *
131 * @return \TYPO3\CMS\Extbase\Mvc\Controller\Arguments
132 * @api
133 */
134 public function getArguments()
135 {
136 return $this->arguments;
137 }
138
139 /**
140 * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder
141 */
142 public function setUriBuilder(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder)
143 {
144 $this->uriBuilder = $uriBuilder;
145 }
146
147 /**
148 * @return \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
149 * @api
150 */
151 public function getUriBuilder()
152 {
153 return $this->uriBuilder;
154 }
155
156 /**
157 * @param string $identifier Queue-identifier
158 * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue
159 * @api
160 */
161 public function getFlashMessageQueue($identifier = null)
162 {
163 if ($identifier === null) {
164 if ($this->flashMessageQueueDefaultIdentifier === null) {
165 // cache the default-identifier for performance-reasons
166 $this->flashMessageQueueDefaultIdentifier = 'extbase.flashmessages.' . $this->extensionService->getPluginNamespace($this->request->getControllerExtensionName(), $this->request->getPluginName());
167 }
168 $identifier = $this->flashMessageQueueDefaultIdentifier;
169 }
170 return $this->flashMessageService->getMessageQueueByIdentifier($identifier);
171 }
172 }