private function createStageCallback() : Closure
    {
        return function ($stages, $stage) {
            return function ($input) use ($stages, $stage) {
                if ($stage instanceof Closure) {
                    return $stage($input, $stages);
                } else {
                    if ($this->methodToCall === null) {
                        throw new PipelineException('Method must not be null');
                    }

                    if (!method_exists($stage, $this->methodToCall)) {
                        throw new PipelineException(get_class($stage) . "::{$this->methodToCall} does not exist");
                    }

                    return $stage->{$this->methodToCall}($input, $stages);
                }
            };
        };
    }
private function createStageCallback() : Closure
    {
        return function ($stages, $stage) {
            return function ($input) use ($stages, $stage) {
                if ($stage instanceof Closure) {
                    return $stage($input, $stages);
                } else {
                    if ($this->methodToCall === null) {
                        throw new PipelineException('Method must not be null');
                    }

                    if (!method_exists($stage, $this->methodToCall)) {
                        throw new PipelineException(get_class($stage) . "::{$this->methodToCall} does not exist");
                    }

                    return $stage->{$this->methodToCall}($input, $stages);
                }
            };
        };
    }
private function createStageCallback ( ) : Closure { return function ( $ stages , $ stage ) { return function ( $ input ) use ( $ stages , $ stage ) { if ( $ stage instanceof Closure ) { return $ stage ( $ input , $ stages ) ; } else { if ( $ this -> methodToCall === null ) { throw new PipelineException ( 'Method must not be null' ) ; } if ( ! method_exists ( $ stage , $ this -> methodToCall ) ) { throw new PipelineException ( get_class ( $ stage ) . "::{$this->methodToCall} does not exist" ) ; } return $ stage -> { $ this -> methodToCall } ( $ input , $ stages ) ; } } ; } ; }
Creates a callback for an individual stage

@return Closure The callback
@throws PipelineException Thrown if there was a problem creating a stage
Creates a callback for an individual stage