class-IXR-clientmulticall.php 1.2 KB

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