protected function setState(int $state) : bool
    {
        $this->workerState = $state;

        // report idle state to server:
        $this->replySocket->send(json_encode([
            'request' => 'change_state',
            'worker_id' => $this->workerId,
            'state' => $this->workerState
        ]));
        $response = $this->replySocket->recv();
        return ($response === 'ok');
    }
protected function setState(int $state) : bool
    {
        $this->workerState = $state;

        // report idle state to server:
        $this->replySocket->send(json_encode([
            'request' => 'change_state',
            'worker_id' => $this->workerId,
            'state' => $this->workerState
        ]));
        $response = $this->replySocket->recv();
        return ($response === 'ok');
    }
protected function setState ( int $ state ) : bool { $ this -> workerState = $ state ; // report idle state to server: $ this -> replySocket -> send ( json_encode ( [ 'request' => 'change_state' , 'worker_id' => $ this -> workerId , 'state' => $ this -> workerState ] ) ) ; $ response = $ this -> replySocket -> recv ( ) ; return ( $ response === 'ok' ) ; }
Sets a new worker state and reports this state to server.

@param int $state
@return bool
Sets a new worker state and reports this state to server .