PAGI\Node\Node::callClientMethod PHP Method

callClientMethod() protected method

Call a specific method on a client.
protected callClientMethod ( string $name, array $arguments = [] ) : PAGI\Client\Result\IResult
$name string
$arguments array
return PAGI\Client\Result\IResult
    protected function callClientMethod($name, array $arguments = array())
    {
        $this->logDebug("{$name}(" . implode(",", $arguments) . ")");
        return call_user_func_array(array($this->client, $name), $arguments);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see PAGI\Node.Node::callClientMethods()
  */
 protected function callClientMethods($methods, $stopWhen = null)
 {
     $client = $this->getClient();
     $logger = $client->getLogger();
     $result = null;
     foreach ($methods as $callInfo) {
         foreach ($callInfo as $name => $arguments) {
             switch ($name) {
                 case 'streamFile':
                 case 'sayNumber':
                 case 'sayDigits':
                 case 'sayDateTime':
                     $this->sayInterruptable($name, $arguments);
                     break;
                 case 'waitDigit':
                     if (empty($this->mockedInput)) {
                         $client->onWaitDigit(false);
                     } else {
                         $digit = array_shift($this->mockedInput);
                         if ($digit == ' ') {
                             $client->onWaitDigit(false);
                         } else {
                             $client->onWaitDigit(true, $digit);
                         }
                     }
                     break;
                 default:
                     break;
             }
             $result = parent::callClientMethod($name, $arguments);
             if ($stopWhen !== null) {
                 if ($stopWhen($result)) {
                     return $result;
                 }
             }
         }
     }
     return $result;
 }