protected function handleStage(&$stages, $stage)
	{
		if ($stage instanceof Pipeline) {
			$stages = array_merge($stages, $stage->stages());
		}
		elseif ($stage instanceof MiddlewareInterface) {
			$stages[] = $stage;
		}
		elseif ($stage instanceof RequestHandlerInterface) {
			$stages[] = new RequestHandler($stage);
		}
		elseif (is_callable($stage)) {
			$stages[] = new Lambda($stage);
		}
		else {
			throw new InvalidMiddlewareArgument(is_string($stage) ? $stage : get_class($stage));
		}
	}