public function __construct(Config $configuration)
{
$this->configuration = $configuration;
$this->container = $configuration->getContainer();
$this->router = $configuration->getRouter();
$this->emitter = $configuration->getEventEmitter();
AnnotationRegistry::registerLoader('class_exists');
$this->registerService($configuration->getHateoasService(), $configuration->getHateoasConfig());
$this->registerService($configuration->getLoggerService(), $configuration->getLoggerConfig());
$this->setErrorHandler();
$this->container->add(self::CONTAINER_ID_VENDOR, $configuration->getVendor());
$this->container->add(self::CONTAINER_ID_API_VERSION, $configuration->getApiVersion());
$this->container->add(self::CONTAINER_ID_DEBUG, $configuration->isDebug());
$this->container->add(self::CONTAINER_ID_ROUTER, function () {
return $this->router;
});
$this->stackBuilder = new Stack\Builder();
}