protected function _getJobResult(Job $job)
    {
        $jobHash = spl_object_hash($job);
        if (isset($this->runningJobs[$jobHash])) {
            $jobDir = $this->_getJobDirectory($job);
            if (file_exists("$jobDir/out.serialize")) {
                $data = unserialize(file_get_contents("$jobDir/out.serialize"));

                $jobData = $this->runningJobs[$jobHash];

                $job->setData($data);
                $job->end($jobData);

                // Delete data on this job.
                flock($jobData->lockFile, LOCK_UN);
                fclose($jobData->lockFile);
                $this->rm($jobData->jobDir);

                unset($this->runningJobs[$jobHash]);
                return true;
            } else {
                return false;
            }
        }

        return true;
    }
protected function _getJobResult(Job $job)
    {
        $jobHash = spl_object_hash($job);
        if (isset($this->runningJobs[$jobHash])) {
            $jobDir = $this->_getJobDirectory($job);
            if (file_exists("$jobDir/out.serialize")) {
                $data = unserialize(file_get_contents("$jobDir/out.serialize"));

                $jobData = $this->runningJobs[$jobHash];

                $job->setData($data);
                $job->end($jobData);

                // Delete data on this job.
                flock($jobData->lockFile, LOCK_UN);
                fclose($jobData->lockFile);
                $this->rm($jobData->jobDir);

                unset($this->runningJobs[$jobHash]);
                return true;
            } else {
                return false;
            }
        }

        return true;
    }
protected function _getJobResult ( Job $ job ) { $ jobHash = spl_object_hash ( $ job ) ; if ( isset ( $ this -> runningJobs [ $ jobHash ] ) ) { $ jobDir = $ this -> _getJobDirectory ( $ job ) ; if ( file_exists ( "$jobDir/out.serialize" ) ) { $ data = unserialize ( file_get_contents ( "$jobDir/out.serialize" ) ) ; $ jobData = $ this -> runningJobs [ $ jobHash ] ; $ job -> setData ( $ data ) ; $ job -> end ( $ jobData ) ; // Delete data on this job. flock ( $ jobData -> lockFile , LOCK_UN ) ; fclose ( $ jobData -> lockFile ) ; $ this -> rm ( $ jobData -> jobDir ) ; unset ( $ this -> runningJobs [ $ jobHash ] ) ; return true ; } else { return false ; } } return true ; }
Check if a job is terminated, handle the finish & return true or false if finished or not.

@param Job $job The job to check.

@throws \Exception

@return bool
Check if a job is terminated handle the finish & return true or false if finished or not .