Example #1
0
 /**
  * Adrenaline constructor.
  *
  * Very flexible constructor to customize Adrenaline how you want it to be.
  * If you don't need any customizations concerning routing / action / responder middlewares
  * please use {@link \bitExpert\Adrenaline\Adrenaline::create} instead
  *
  * @param \bitExpert\Adroit\Action\Resolver\ActionResolver[] $actionResolvers
  * @param \bitExpert\Adroit\Action\Resolver\ActionResolver[] $responderResolvers
  * @param Router|null $router
  * @param EmitterInterface|null $emitter
  */
 public function __construct(array $actionResolvers = [], array $responderResolvers = [], Router $router = null, EmitterInterface $emitter = null)
 {
     $actionResolvers = count($actionResolvers) ? $actionResolvers : [new CallableActionResolver()];
     $responderResolvers = count($responderResolvers) ? $responderResolvers : [new CallableResponderResolver()];
     parent::__construct(RoutingResult::class, $actionResolvers, $responderResolvers);
     $this->router = $router ?: new Psr7Router();
     $this->defaultRouteClass = Route::class;
     $this->beforeRoutingMiddlewares = [];
     $this->beforeEmitterMiddlewares = [];
     $this->emitter = $emitter ?: new SapiEmitter();
     $this->errorHandler = null;
 }