protected function build($stage)
	{
		if ($stage instanceof MiddlewareInterface) {
			return $stage;
		}

		if ($this->container->has($stage)) {
			$stage = $this->container->get($stage);
			if ($stage instanceof RequestHandlerInterface) {
				return new RequestHandler($stage);
			}

			if ($stage instanceof MiddlewareInterface) {
				return $stage;
			}

			throw new \RuntimeException("Stage is not a valid " . MiddlewareInterface::class);
		}

		// Support aura/di
		if (method_exists($this->container, 'newInstance')) {
			return $this->container->newInstance($stage);
		}

		throw new \RuntimeException("Unable to resolve $stage");
	}