1<?php
2namespace IXR\Client;
3
4/**
5 * IXR_ClientMulticall
6 *
7 * @package IXR
8 * @since 1.5.0
9 */
10class ClientMulticall extends Client
11{
12    private $calls = [];
13
14    public function __construct($server, $path = false, $port = 80)
15    {
16        parent::__construct($server, $path, $port);
17        $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
18    }
19
20    public function addCall()
21    {
22        $args = func_get_args();
23        $methodName = array_shift($args);
24        $struct = [
25            'methodName' => $methodName,
26            'params' => $args
27        ];
28        $this->calls[] = $struct;
29    }
30
31    public function query()
32    {
33        // Prepare multicall, then call the parent::query() method
34        return parent::query('system.multicall', $this->calls);
35    }
36}
37