Example #1
0
 /**
  * Calls parent call() method to send data to the socket and to receive the response
  * 
  * @throws instance of AbstractException
  * @param  string $method
  * @param  array $params
  * @return mixed
  */
 public function __call($method, $params)
 {
     try {
         $return = parent::call($method, $params);
         if (is_object($return)) {
         } else {
         }
         return $return;
     } catch (\Novutec\MessagePackRpcClient\AbstractException $e) {
         if ($this->throwExceptions) {
             throw $e;
         }
         return array('code' => $e->getCode(), 'msg' => $e->getMessage());
     }
 }
Example #2
0
<?php

//多态
abstract class Tiger
{
    public abstract function climb();
}
class XTiger extends Tiger
{
    public function climb()
    {
        echo '我不会爬树';
    }
}
class MTiger extends Tiger
{
    public function climb()
    {
        echo '我会啊';
    }
}
//客户端调用
class Client
{
    public static function call(Tiger $animal)
    {
        $animal->climb();
    }
}
Client::call(new MTiger());
 public function testInvalidMethodName()
 {
     $this->setExpectedException('fXmlRpc\\Exception\\InvalidArgumentException', 'Expected parameter 0 to be of type "string", "object" of type "stdClass" given');
     $this->client->call(new \stdClass());
 }
Example #4
0
 /**
  * @param string $method
  * @param array $arguments
  *
  * @return mixed
  */
 public function __call($method, $arguments)
 {
     return $this->client->call($method, $arguments);
 }