‪TYPO3CMS  9.5
RequestHandler.php
Go to the documentation of this file.
1 <?php
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 
18 
25 {
29  protected ‪$objectManager;
30 
34  protected ‪$dispatcher;
35 
39  protected ‪$requestBuilder;
40 
44  public function ‪injectObjectManager(\‪TYPO3\CMS\‪Extbase\Object\ObjectManagerInterface ‪$objectManager)
45  {
46  $this->objectManager = ‪$objectManager;
47  }
48 
53  {
54  $this->dispatcher = ‪$dispatcher;
55  }
56 
61  {
62  $this->requestBuilder = ‪$requestBuilder;
63  }
64 
70  public function ‪handleRequest()
71  {
72  $commandLine = $_SERVER['argv'] ?? [];
73  $callingScript = array_shift($commandLine);
74  if ($callingScript !== $_SERVER['_']) {
75  $callingScript = $_SERVER['_'] . ' ' . $callingScript;
76  }
77 
78  $request = $this->requestBuilder->build($commandLine, $callingScript);
80  $response = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Mvc\Cli\Response::class);
81  $this->dispatcher->dispatch($request, $response);
82  $response->send();
83  return $response;
84  }
85 
91  public function ‪canHandleRequest()
92  {
93  return ‪Environment::isCli();
94  }
95 
102  public function ‪getPriority()
103  {
104  return 100;
105  }
106 }
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Mvc\Dispatcher
Definition: Dispatcher.php:23
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\injectRequestBuilder
‪injectRequestBuilder(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder $requestBuilder)
Definition: RequestHandler.php:57
‪TYPO3
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\getPriority
‪int getPriority()
Definition: RequestHandler.php:99
‪TYPO3\CMS\Extbase\Mvc\Cli
Definition: Command.php:2
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\handleRequest
‪TYPO3 CMS Extbase Mvc ResponseInterface handleRequest()
Definition: RequestHandler.php:67
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\injectDispatcher
‪injectDispatcher(\TYPO3\CMS\Extbase\Mvc\Dispatcher $dispatcher)
Definition: RequestHandler.php:49
‪TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface
Definition: RequestHandlerInterface.php:21
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: RequestHandler.php:28
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\injectObjectManager
‪injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
Definition: RequestHandler.php:41
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\$requestBuilder
‪TYPO3 CMS Extbase Mvc Cli RequestBuilder $requestBuilder
Definition: RequestHandler.php:36
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder
Definition: RequestBuilder.php:23
‪TYPO3\CMS\Core\Core\Environment\isCli
‪static bool isCli()
Definition: Environment.php:127
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\$dispatcher
‪TYPO3 CMS Extbase Mvc Dispatcher $dispatcher
Definition: RequestHandler.php:32
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler\canHandleRequest
‪bool canHandleRequest()
Definition: RequestHandler.php:88
‪TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler
Definition: RequestHandler.php:25