mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-30 21:17:57 +01:00
6cb2f5491b
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable. This makes the signature of `WP_HTTP_IXR_Client::query()` compatible with the parent class method. Follow-up to [48204]. Props ayeshrajans. See #48267, #47678. Built from https://develop.svn.wordpress.org/trunk@48238 git-svn-id: http://core.svn.wordpress.org/trunk@48007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* IXR_ClientMulticall
|
|
*
|
|
* @package IXR
|
|
* @since 1.5.0
|
|
*/
|
|
class IXR_ClientMulticall extends IXR_Client
|
|
{
|
|
var $calls = array();
|
|
|
|
/**
|
|
* PHP5 constructor.
|
|
*/
|
|
function __construct( $server, $path = false, $port = 80 )
|
|
{
|
|
parent::IXR_Client($server, $path, $port);
|
|
$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
|
|
}
|
|
|
|
/**
|
|
* PHP4 constructor.
|
|
*/
|
|
public function IXR_ClientMulticall( $server, $path = false, $port = 80 ) {
|
|
self::__construct( $server, $path, $port );
|
|
}
|
|
|
|
/**
|
|
* @since 1.5.0
|
|
* @since 5.5.0 Formalized the existing `...$args` parameter by adding it
|
|
* to the function signature.
|
|
*/
|
|
function addCall( ...$args )
|
|
{
|
|
$methodName = array_shift($args);
|
|
$struct = array(
|
|
'methodName' => $methodName,
|
|
'params' => $args
|
|
);
|
|
$this->calls[] = $struct;
|
|
}
|
|
|
|
/**
|
|
* @since 1.5.0
|
|
* @since 5.5.0 Formalized the existing `...$args` parameter by adding it
|
|
* to the function signature.
|
|
*
|
|
* @return bool
|
|
*/
|
|
function query( ...$args )
|
|
{
|
|
// Prepare multicall, then call the parent::query() method
|
|
return parent::query('system.multicall', $this->calls);
|
|
}
|
|
}
|