private function setUp($class, Run $run)
    {
        if (!$class) {
            $run->writeOutput("Missing `class` parameter on {$this->jobModel->id} job")
                ->setResult(Run::RESULT_FAILED);

            return false;
        }

        if (!class_exists($class)) {
            $run->writeOutput("$class does not exist")
                ->setResult(Run::RESULT_FAILED);

            return false;
        }

        $job = new $class();

        // inject the DI container if needed
        if (method_exists($job, 'setApp')) {
            $job->setApp($this->jobModel->getApp());
        }

        return $job;
    }
private function setUp($class, Run $run)
    {
        if (!$class) {
            $run->writeOutput("Missing `class` parameter on {$this->jobModel->id} job")
                ->setResult(Run::RESULT_FAILED);

            return false;
        }

        if (!class_exists($class)) {
            $run->writeOutput("$class does not exist")
                ->setResult(Run::RESULT_FAILED);

            return false;
        }

        $job = new $class();

        // inject the DI container if needed
        if (method_exists($job, 'setApp')) {
            $job->setApp($this->jobModel->getApp());
        }

        return $job;
    }
private function setUp ( $ class , Run $ run ) { if ( ! $ class ) { $ run -> writeOutput ( "Missing `class` parameter on {$this->jobModel->id} job" ) -> setResult ( Run :: RESULT_FAILED ) ; return false ; } if ( ! class_exists ( $ class ) ) { $ run -> writeOutput ( "$class does not exist" ) -> setResult ( Run :: RESULT_FAILED ) ; return false ; } $ job = new $ class ( ) ; // inject the DI container if needed if ( method_exists ( $ job , 'setApp' ) ) { $ job -> setApp ( $ this -> jobModel -> getApp ( ) ) ; } return $ job ; }
Sets up an invokable class for a scheduled job run.

@param string $class
@param Run    $run

@return callable|false
Sets up an invokable class for a scheduled job run .