PHPDaemon\Clients\GearmanClient\Connection::onRead PHP Method

onRead() public method

Called when new data received
public onRead ( ) : void
return void
    public function onRead()
    {
        if (($head = $this->lookExact(static::HEADER_LENGTH)) === false) {
            return;
        }
        list($magic, $typeInt, $size) = unpack(static::HEADER_READ_FORMAT, $head);
        if ($this->getInputLength() < static::HEADER_LENGTH + $size) {
            return;
        }
        $this->drain(static::HEADER_LENGTH);
        $pct = $this->read($size);
        if ($magic === static::MAGIC_RESPONSE) {
            $this->responseType = static::$responseCommandListFlipped[$typeInt];
            $this->response = explode(static::ARGS_DELIMITER, $pct);
            $this->onResponse->executeOne($this);
            $this->responseType = null;
            $this->responseCommand = null;
            $this->responseType = null;
            $this->checkFree();
            return;
        } else {
            $type = static::$requestCommandListFlipped[$typeInt];
            // @TODO
        }
    }