public function setUp()
 {
     $this->dic = new AurynDependencyInjectionContainer();
     $webModule = new WebModule();
     $guzzleModule = new GuzzleHTTPModule();
     $controllerModule = new ControllerProcessorWebModule();
     $config = [$webModule->getModuleKey() => [], $guzzleModule->getModuleKey() => [], $controllerModule->getModuleKey() => []];
     $webModule->loadConfiguration($config[$webModule->getModuleKey()], $config);
     $guzzleModule->loadConfiguration($config[$guzzleModule->getModuleKey()], $config);
     $controllerModule->loadConfiguration($config[$controllerModule->getModuleKey()], $config);
     $this->dic->alias(Router::class, RouterMock::class);
     $this->dic->alias(ControllerViewProcessor::class, ControllerViewProcessorMock::class);
     $webModule->configureDependencyInjection($this->dic, $config[$webModule->getModuleKey()], $config);
     $guzzleModule->configureDependencyInjection($this->dic, $config[$guzzleModule->getModuleKey()], $config);
     $controllerModule->configureDependencyInjection($this->dic, $config[$controllerModule->getModuleKey()], $config);
 }
 /**
  * {@inheritdoc}
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(TemplateEngine::class, TwigTemplateEngine::class);
     if (!isset($moduleConfig[self::CONFIG_DEBUG])) {
         $moduleConfig[self::CONFIG_DEBUG] = false;
     }
     $dic->setClassParameters(TwigTemplateEngine::class, ['debug' => $moduleConfig[self::CONFIG_DEBUG]]);
 }
 /**
  * {@inheritdoc}
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(ControllerViewProcessor::class, TemplateViewProcessor::class);
     if (!array_key_exists(self::CONFIG_TEMPLATE_ROOTS, $moduleConfig)) {
         $moduleConfig[self::CONFIG_TEMPLATE_ROOTS] = [];
     }
     $templateRoots = $moduleConfig[self::CONFIG_TEMPLATE_ROOTS];
     $dic->setClassParameters(TemplateViewProcessor::class, ['templateRoots' => $templateRoots]);
 }
 /**
  * {@inheritdoc}
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(Router::class, FastRouteRouter::class);
     if (!$this->isArrayInArray($moduleConfig, 'routes')) {
         throw new FastRouteConfigurationException('Missing or invalid configuration option \'' . $this->getModuleKey() . '.routes\' for ' . __CLASS__);
     }
     if (!$this->isArrayInArray($moduleConfig, 'errorHandlers')) {
         throw new FastRouteConfigurationException('Missing or invalid configuration option \'' . $this->getModuleKey() . '.errorHandlers\' for ' . __CLASS__);
     }
     $dic->setClassParameters(FastRouteConfiguration::class, ['routes' => $moduleConfig['routes'], 'errorHandlers' => $moduleConfig['errorHandlers']]);
 }
 /**
  * {@inheritdoc}
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(RequestProcessor::class, ControllerRequestProcessor::class);
     $dic->alias(PSR7ControllerResponseHandler::class, ControllerResponseProcessor::class);
     $dic->alias(StringControllerResponseHandler::class, ControllerResponseProcessor::class);
     $dic->alias(ArrayControllerResponseHandler::class, ControllerResponseProcessor::class);
     if (!isset($moduleConfig['filters'])) {
         $moduleConfig['filters'] = [];
     }
     $psr7Filters = [];
     if (!isset($moduleConfig['filters']['psr7'])) {
         $moduleConfig['filters']['psr7'] = [];
     }
     foreach ($moduleConfig['filters']['psr7'] as $filterClass) {
         $psr7Filters[] = new DICFilterFactory($dic, $filterClass);
     }
     $stringFilters = [];
     if (!isset($moduleConfig['filters']['string'])) {
         $moduleConfig['filters']['string'] = [];
     }
     foreach ($moduleConfig['filters']['string'] as $filterClass) {
         $stringFilters[] = new DICFilterFactory($dic, $filterClass);
     }
     $arrayFilters = [];
     if (!isset($moduleConfig['filters']['array'])) {
         $moduleConfig['filters']['array'] = [];
     }
     foreach ($moduleConfig['filters']['array'] as $filterClass) {
         $arrayFilters[] = new DICFilterFactory($dic, $filterClass);
     }
     $dic->setClassParameters(ControllerResponseProcessor::class, ['stringFilterFactories' => $stringFilters, 'arrayFilterFactories' => $arrayFilters, 'psr7FilterFactories' => $psr7Filters]);
     $dic->setClassParameters(DICRouteDispatcher::class, ['dic' => $dic]);
     $routingResponseFilters = $this->makeFilters($moduleConfig[self::CONFIG_FILTERS_ROUTING_RESPONSE], $dic);
     $dic->setClassParameters(RouteProcessor::class, ['routingResponseFilters' => $routingResponseFilters]);
     $requestFilters = $this->makeFilters($moduleConfig[self::CONFIG_FILTERS_REQUEST], $dic);
     $responseFilters = $this->makeFilters($moduleConfig[self::CONFIG_FILTERS_RESPONSE], $dic);
     $dic->setClassParameters(ControllerRequestProcessor::class, ['requestFilters' => $requestFilters, 'responseFilters' => $responseFilters]);
 }
 /**
  * {@inheritdoc}
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(TemplateEngine::class, SmartyTemplateEngine::class);
 }
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(HTTPServerFactory::class, GuzzleHTTPServerFactory::class);
     $dic->alias(ServerRequestInterface::class, ServerRequest::class);
     $dic->alias(ResponseInterface::class, Response::class);
 }
 /**
  * Configures StandardInputProcessor and StandardOutputProcessor as IO handlers and wires up the input processor
  * to use standard PHP superglobals for input.
  *
  * @param DependencyInjectionContainer $dic
  * @param array                        $moduleConfig
  * @param array                        $globalConfig
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig)
 {
     $dic->alias(InputProcessor::class, StandardInputProcessor::class);
     $dic->alias(OutputProcessor::class, StandardOutputProcessor::class);
     $dic->setClassParameters(InputProcessor::class, ['server' => $_SERVER, 'get' => $_GET, 'post' => $_POST, 'cookie' => $_COOKIE]);
 }