[TASK] Streamline phpdoc annotations in EXT:extbase
[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 class ControllerContext
21 {
22 /**
23 * @var \TYPO3\CMS\Extbase\Mvc\Request
24 */
25 protected $request;
26
27 /**
28 * @var \TYPO3\CMS\Extbase\Mvc\Response
29 */
30 protected $response;
31
32 /**
33 * @var \TYPO3\CMS\Extbase\Mvc\Controller\Arguments
34 */
35 protected $arguments;
36
37 /**
38 * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
39 */
40 protected $uriBuilder;
41
42 /**
43 * @var string
44 */
45 protected $flashMessageQueueDefaultIdentifier;
46
47 /**
48 * @var \TYPO3\CMS\Core\Messaging\FlashMessageService
49 */
50 protected $flashMessageService;
51
52 /**
53 * @var \TYPO3\CMS\Extbase\Service\ExtensionService
54 */
55 protected $extensionService;
56
57 /**
58 * @param \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService
59 */
60 public function injectFlashMessageService(\TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService)
61 {
62 $this->flashMessageService = $flashMessageService;
63 }
64
65 /**
66 * @param \TYPO3\CMS\Extbase\Service\ExtensionService $extensionService
67 */
68 public function injectExtensionService(\TYPO3\CMS\Extbase\Service\ExtensionService $extensionService)
69 {
70 $this->extensionService = $extensionService;
71 }
72
73 /**
74 * Set the request of the controller
75 *
76 * @param \TYPO3\CMS\Extbase\Mvc\Request $request
77 */
78 public function setRequest(\TYPO3\CMS\Extbase\Mvc\Request $request)
79 {
80 $this->request = $request;
81 }
82
83 /**
84 * Get the request of the controller
85 *
86 * @return \TYPO3\CMS\Extbase\Mvc\Request
87 */
88 public function getRequest()
89 {
90 return $this->request;
91 }
92
93 /**
94 * Set the response of the controller
95 *
96 * @param \TYPO3\CMS\Extbase\Mvc\Response $response
97 */
98 public function setResponse(\TYPO3\CMS\Extbase\Mvc\Response $response)
99 {
100 $this->response = $response;
101 }
102
103 /**
104 * Get the response of the controller
105 *
106 * @return \TYPO3\CMS\Extbase\Mvc\Response
107 */
108 public function getResponse()
109 {
110 return $this->response;
111 }
112
113 /**
114 * Set the arguments of the controller
115 *
116 * @param \TYPO3\CMS\Extbase\Mvc\Controller\Arguments $arguments
117 */
118 public function setArguments(\TYPO3\CMS\Extbase\Mvc\Controller\Arguments $arguments)
119 {
120 $this->arguments = $arguments;
121 }
122
123 /**
124 * Get the arguments of the controller
125 *
126 * @return \TYPO3\CMS\Extbase\Mvc\Controller\Arguments
127 */
128 public function getArguments()
129 {
130 return $this->arguments;
131 }
132
133 /**
134 * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder
135 */
136 public function setUriBuilder(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder)
137 {
138 $this->uriBuilder = $uriBuilder;
139 }
140
141 /**
142 * @return \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
143 */
144 public function getUriBuilder()
145 {
146 return $this->uriBuilder;
147 }
148
149 /**
150 * @param string $identifier Queue-identifier
151 * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue
152 */
153 public function getFlashMessageQueue($identifier = null)
154 {
155 if ($identifier === null) {
156 if ($this->flashMessageQueueDefaultIdentifier === null) {
157 // cache the default-identifier for performance-reasons
158 $this->flashMessageQueueDefaultIdentifier = 'extbase.flashmessages.' . $this->extensionService->getPluginNamespace($this->request->getControllerExtensionName(), $this->request->getPluginName());
159 }
160 $identifier = $this->flashMessageQueueDefaultIdentifier;
161 }
162 return $this->flashMessageService->getMessageQueueByIdentifier($identifier);
163 }
164 }