TYPO3 CMS  TYPO3_6-2
RequestHandlerResolver.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Extbase\Mvc;
3 
20 
25  protected $objectManager;
26 
31  protected $reflectionService;
32 
38 
46  public function resolveRequestHandler() {
47  $availableRequestHandlerClassNames = $this->getRegisteredRequestHandlerClassNames();
48  $suitableRequestHandlers = array();
49  foreach ($availableRequestHandlerClassNames as $requestHandlerClassName) {
50  $requestHandler = $this->objectManager->get($requestHandlerClassName);
51  if ($requestHandler->canHandleRequest()) {
52  $priority = $requestHandler->getPriority();
53  if (isset($suitableRequestHandlers[$priority])) {
54  throw new \TYPO3\CMS\Extbase\Mvc\Exception('More than one request handler with the same priority can handle the request, but only one handler may be active at a time!', 1176475350);
55  }
56  $suitableRequestHandlers[$priority] = $requestHandler;
57  }
58  }
59  if (count($suitableRequestHandlers) === 0) {
60  throw new \TYPO3\CMS\Extbase\Mvc\Exception('No suitable request handler found.', 1205414233);
61  }
62  ksort($suitableRequestHandlers);
63  return array_pop($suitableRequestHandlers);
64  }
65 
72  $settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
73  return is_array($settings['mvc']['requestHandlers']) ? $settings['mvc']['requestHandlers'] : array();
74  }
75 }