public function fetchWaitingWorker()
    {
        $count = count($this->waitingList);
        for ($i = 0; $i < $count; $i++) {
            $worker = array_shift($this->waitingList);
            if ($worker->isValid() && $worker->isReady()) {
                return $worker;
            }
        }

        $this->ready = false;

        return null;
    }
public function fetchWaitingWorker()
    {
        $count = count($this->waitingList);
        for ($i = 0; $i < $count; $i++) {
            $worker = array_shift($this->waitingList);
            if ($worker->isValid() && $worker->isReady()) {
                return $worker;
            }
        }

        $this->ready = false;

        return null;
    }
public function fetchWaitingWorker ( ) { $ count = count ( $ this -> waitingList ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ worker = array_shift ( $ this -> waitingList ) ; if ( $ worker -> isValid ( ) && $ worker -> isReady ( ) ) { return $ worker ; } } $ this -> ready = false ; return null ; }
Gets the first available worker in the waiting list.

@return Worker|null
Gets the first available worker in the waiting list .