protected function handleStage(&$stages, $stage)
    {
        if ($stage instanceof Pipeline) {
            $stages = array_merge($stages, $stage->stages());
        } else {
            $stages[] = is_callable($stage) ? new Callback($stage) : $stage;
        }
    }