public function updateProgress()
    {
        foreach ($this->employees as $employee) {
            if ($employee->isBusy()) {
                continue;
            }

            if ($employee->isFree()) {
                continue;
            }

            $job = $employee->getJob();

            switch ($employee->getWorkState()) {
                case Employee::COMPLETE:
                    if (method_exists($job, 'beforeComplete')) {
                        $job->beforeComplete();
                    }
                    $this->pipeline->complete($job);
                    break;
                case Employee::FAILED:
                    if (method_exists($job, 'beforeFail')) {
                        $job->beforeFail();
                    }
                    if ($job->mayTryAgain()) {
                        $this->pipeline->reset($job);
                    } else {
                        $this->pipeline->fail($job);
                    }
                    break;
            }

            $employee->free();
        }
    }
public function updateProgress()
    {
        foreach ($this->employees as $employee) {
            if ($employee->isBusy()) {
                continue;
            }

            if ($employee->isFree()) {
                continue;
            }

            $job = $employee->getJob();

            switch ($employee->getWorkState()) {
                case Employee::COMPLETE:
                    if (method_exists($job, 'beforeComplete')) {
                        $job->beforeComplete();
                    }
                    $this->pipeline->complete($job);
                    break;
                case Employee::FAILED:
                    if (method_exists($job, 'beforeFail')) {
                        $job->beforeFail();
                    }
                    if ($job->mayTryAgain()) {
                        $this->pipeline->reset($job);
                    } else {
                        $this->pipeline->fail($job);
                    }
                    break;
            }

            $employee->free();
        }
    }
public function updateProgress ( ) { foreach ( $ this -> employees as $ employee ) { if ( $ employee -> isBusy ( ) ) { continue ; } if ( $ employee -> isFree ( ) ) { continue ; } $ job = $ employee -> getJob ( ) ; switch ( $ employee -> getWorkState ( ) ) { case Employee :: COMPLETE : if ( method_exists ( $ job , 'beforeComplete' ) ) { $ job -> beforeComplete ( ) ; } $ this -> pipeline -> complete ( $ job ) ; break ; case Employee :: FAILED : if ( method_exists ( $ job , 'beforeFail' ) ) { $ job -> beforeFail ( ) ; } if ( $ job -> mayTryAgain ( ) ) { $ this -> pipeline -> reset ( $ job ) ; } else { $ this -> pipeline -> fail ( $ job ) ; } break ; } $ employee -> free ( ) ; } }
Get a progress update from all employees.
Get a progress update from all employees .