src/Pipeline/IsPipeline.php
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));
		}
	}
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));
		}
	}
Handles merging or converting the stage to a callback

@param array                    $stages
@param Pipeline|MiddlewareInterface|RequestHandlerInterface|string|callable $stage