private function invoke(callable $job, Run $run)
    {
        try {
            ob_start();

            $ret = call_user_func($job, $run);
            $result = Run::RESULT_SUCCEEDED;
            if (false === $ret) {
                $result = Run::RESULT_FAILED;
            }

            return $run->writeOutput(ob_get_clean())
                       ->setResult($result);
        } catch (Exception $e) {
            if ($this->logger) {
                $this->logger->error("An uncaught exception occurred while running the {$this->jobModel->id()} scheduled job.", ['exception' => $e]);
            }

            return $run->writeOutput(ob_get_clean())
                       ->writeOutput($e->getMessage())
                       ->setResult(Run::RESULT_FAILED);
        }
    }
private function invoke(callable $job, Run $run)
    {
        try {
            ob_start();

            $ret = call_user_func($job, $run);
            $result = Run::RESULT_SUCCEEDED;
            if (false === $ret) {
                $result = Run::RESULT_FAILED;
            }

            return $run->writeOutput(ob_get_clean())
                       ->setResult($result);
        } catch (Exception $e) {
            if ($this->logger) {
                $this->logger->error("An uncaught exception occurred while running the {$this->jobModel->id()} scheduled job.", ['exception' => $e]);
            }

            return $run->writeOutput(ob_get_clean())
                       ->writeOutput($e->getMessage())
                       ->setResult(Run::RESULT_FAILED);
        }
    }
private function invoke ( callable $ job , Run $ run ) { try { ob_start ( ) ; $ ret = call_user_func ( $ job , $ run ) ; $ result = Run :: RESULT_SUCCEEDED ; if ( false === $ ret ) { $ result = Run :: RESULT_FAILED ; } return $ run -> writeOutput ( ob_get_clean ( ) ) -> setResult ( $ result ) ; } catch ( Exception $ e ) { if ( $ this -> logger ) { $ this -> logger -> error ( "An uncaught exception occurred while running the {$this->jobModel->id()} scheduled job." , [ 'exception' => $ e ] ) ; } return $ run -> writeOutput ( ob_get_clean ( ) ) -> writeOutput ( $ e -> getMessage ( ) ) -> setResult ( Run :: RESULT_FAILED ) ; } }
Executes the actual job.

@param Run $run

@return Run
Executes the actual job .