public function encode()
    {
        $count = count($this->messages);

        if ($count === 0) {
            return null;
        }

        if ($count === 1) {
            $output = array_shift($this->messages);
        } else {
            $output = $this->messages;
        }

        $this->messages = array();

        return json_encode($output);
    }
public function encode()
    {
        $count = count($this->messages);

        if ($count === 0) {
            return null;
        }

        if ($count === 1) {
            $output = array_shift($this->messages);
        } else {
            $output = $this->messages;
        }

        $this->messages = array();

        return json_encode($output);
    }
public function encode ( ) { $ count = count ( $ this -> messages ) ; if ( $ count === 0 ) { return null ; } if ( $ count === 1 ) { $ output = array_shift ( $ this -> messages ) ; } else { $ output = $ this -> messages ; } $ this -> messages = array ( ) ; return json_encode ( $ output ) ; }
Encodes the requests as a valid JSON-RPC 2.0 string

This also resets the Client, so you can perform more queries using
the same Client object.

@return null|string
Returns a valid JSON-RPC 2.0 message string
Returns null if there is nothing to encode
Encodes the requests as a valid JSON - RPC 2 . 0 string