[BUGFIX] Call RequestHandlerResolver also for CLI requests
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Mvc / Cli / Response.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Mvc\Cli;
3
4 /***************************************************************
5 * Copyright notice
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of TYPO3 Flow.
9 * All credits go to the TYPO3 Flow team.
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * A CLI specific response implementation
29 *
30 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
31 */
32 class Response extends \TYPO3\CMS\Extbase\Mvc\Response {
33
34 /**
35 * @var integer
36 */
37 private $exitCode = 0;
38
39 /**
40 * Sets the numerical exit code which should be returned when exiting this application.
41 *
42 * @param integer $exitCode
43 * @throws \InvalidArgumentException
44 * @return void
45 * @api
46 */
47 public function setExitCode($exitCode) {
48 if (!is_integer($exitCode)) {
49 throw new \InvalidArgumentException(sprintf('Tried to set invalid exit code. The value must be integer, %s given.', gettype($exitCode)), 1312222064);
50 }
51 $this->exitCode = $exitCode;
52 }
53
54 /**
55 * Rets the numerical exit code which should be returned when exiting this application.
56 *
57 * @return integer
58 * @api
59 */
60 public function getExitCode() {
61 return $this->exitCode;
62 }
63
64 /**
65 * Renders and sends the whole web response
66 *
67 * @return void
68 * @api
69 */
70 public function send() {
71 if ($this->content !== NULL) {
72 echo $this->shutdown();
73 }
74 }
75 }
76
77 ?>