setResult() публичный Метод

Set result
public setResult ( string $jobname, mixed $result = null ) : boolean
$jobname string Job name
$result mixed Result
Результат boolean
Пример #1
0
 protected function sessionStartNew($cb = null)
 {
     $job = new ComplexJob(function () use(&$job, $cb) {
         $session = $this->appInstance->sessions->startSession(['ip' => $this->getIp(), 'atime' => time(), 'expires' => time() + $this->defaultSessionTTL, 'ttl' => $this->defaultSessionTTL, 'browser' => ['agent' => $this->browser['_id'], 'os' => $this->browser['platform'], 'name' => $this->browser['name'], 'majorver' => $this->browser['majorver'], 'comment' => $this->browser['comment'], 'ismobiledevice' => $this->browser['ismobiledevice']], 'location' => $job->getResult('geoip')], function ($lastError) use(&$session, $cb) {
             if (!$session) {
                 if ($cb !== null) {
                     call_user_func($cb, false);
                 }
                 return;
             }
             $this->sessionId = (string) $session['id'];
             $this->attrs->session = $session;
             try {
                 $this->setcookie(ini_get('session.name'), $this->sessionId, ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), $this->appInstance->config->cookiedomain->value ?: ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
             } finally {
                 call_user_func($cb, true);
             }
         });
     });
     $job('browser', function ($jobname, $job) {
         $this->getBrowser(function () use($jobname, $job) {
             $job->setResult($jobname);
         });
     });
     $job('geoip', function ($jobname, $job) {
         $this->appInstance->geoIP->query($this->getIp(true), function ($loc) use($jobname, $job) {
             $job->setResult($jobname, $loc);
         });
     });
     $job();
 }