public function sync($jobs)
    {
        $updates = 0;

        foreach ($jobs as $job) {

            $args = $job->arguments();

            if (!isset($args[0]) || !is_scalar($args[0]) || !isset($this->tasks[$args[0]])) {
                continue;
            }

            $task = $this->tasks[$args[0]];

            $task->state = $job->state();
            $updates++;
        }

        return $updates;
    }
public function sync($jobs)
    {
        $updates = 0;

        foreach ($jobs as $job) {

            $args = $job->arguments();

            if (!isset($args[0]) || !is_scalar($args[0]) || !isset($this->tasks[$args[0]])) {
                continue;
            }

            $task = $this->tasks[$args[0]];

            $task->state = $job->state();
            $updates++;
        }

        return $updates;
    }
public function sync ( $ jobs ) { $ updates = 0 ; foreach ( $ jobs as $ job ) { $ args = $ job -> arguments ( ) ; if ( ! isset ( $ args [ 0 ] ) || ! is_scalar ( $ args [ 0 ] ) || ! isset ( $ this -> tasks [ $ args [ 0 ] ] ) ) { continue ; } $ task = $ this -> tasks [ $ args [ 0 ] ] ; $ task -> state = $ job -> state ( ) ; $ updates ++ ; } return $ updates ; }
Sync the task states with the passed jobs.

@param Job[] $jobs

@return int
Sync the task states with the passed jobs .