public function getLastError(): string
    {
        if ($this->isConnected() && $this->socket) {
            $err = @socket_last_error($this->socket);
            if ($err) {
                $err = socket_strerror($err);
            }
            if (!$err) {
                $err = 'Unknown error';
            }
            return $err;
        } else {
            return 'Not connected';
        }
    }
public function getLastError(): string
    {
        if ($this->isConnected() && $this->socket) {
            $err = @socket_last_error($this->socket);
            if ($err) {
                $err = socket_strerror($err);
            }
            if (!$err) {
                $err = 'Unknown error';
            }
            return $err;
        } else {
            return 'Not connected';
        }
    }
public function getLastError ( ) : string { if ( $ this -> isConnected ( ) && $ this -> socket ) { $ err = @ socket_last_error ( $ this -> socket ) ; if ( $ err ) { $ err = socket_strerror ( $ err ) ; } if ( ! $ err ) { $ err = 'Unknown error' ; } return $ err ; } else { return 'Not connected' ; } }
Get the last error that occurred on the socket

@return string
Get the last error that occurred on the socket