ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-IXR-clientmulticall.php (1263B)


      1 <?php
      2 /**
      3  * IXR_ClientMulticall
      4  *
      5  * @package IXR
      6  * @since 1.5.0
      7  */
      8 class IXR_ClientMulticall extends IXR_Client
      9 {
     10     var $calls = array();
     11 
     12 	/**
     13 	 * PHP5 constructor.
     14 	 */
     15     function __construct( $server, $path = false, $port = 80 )
     16     {
     17         parent::IXR_Client($server, $path, $port);
     18         $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
     19     }
     20 
     21 	/**
     22 	 * PHP4 constructor.
     23 	 */
     24 	public function IXR_ClientMulticall( $server, $path = false, $port = 80 ) {
     25 		self::__construct( $server, $path, $port );
     26 	}
     27 
     28 	/**
     29 	 * @since 1.5.0
     30 	 * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     31 	 *              to the function signature.
     32 	 */
     33     function addCall( ...$args )
     34     {
     35         $methodName = array_shift($args);
     36         $struct = array(
     37             'methodName' => $methodName,
     38             'params' => $args
     39         );
     40         $this->calls[] = $struct;
     41     }
     42 
     43 	/**
     44 	 * @since 1.5.0
     45 	 * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     46 	 *              to the function signature.
     47 	 *
     48 	 * @return bool
     49 	 */
     50     function query( ...$args )
     51     {
     52         // Prepare multicall, then call the parent::query() method
     53         return parent::query('system.multicall', $this->calls);
     54     }
     55 }