protected function resolvePipe($pipe, $payload)
    {
        if ($pipe instanceof Closure) {
            // process pipe closure
            return call_user_func($pipe, $payload);
        } elseif ($pipe instanceof Pipeline) {
            // process another pipeline instance
            return $pipe->process($payload);
        } elseif (is_string($pipe) && class_exists($pipe)) {
            // process pipe class name
            return $this->processPipeClassName($pipe, $payload);
        } elseif (is_object($pipe)) {
            // process pipe object instance
            return $this->processPipeObject($pipe, $payload);
        } elseif (is_callable($pipe)) {
            // process callable pipe function
            return $pipe($payload);
        }

        // unknown pipe type
        throw new InvalidPipeException();
    }