PHP Version 5
Author: Marcelo Gornstein (marcelog@gmail.com)
Inheritance: implements PAGI\Client\Result\IResult
示例#1
0
 /**
  * Constructor.
  *
  * @param IResult $result Result to decorate.
  *
  * @return void
  */
 public function __construct(IResult $result)
 {
     parent::__construct($result);
     if ($result->isResult(-2)) {
         throw new ExecuteCommandException('Failed to execute');
     }
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param IResult $result Result to decorate.
  *
  * @return void
  */
 public function __construct(IResult $result)
 {
     parent::__construct($result);
     $data = $result->getData();
     $this->_endpos = 0;
     $this->_hangup = strpos($data, 'hangup') !== false;
     $this->_waitfor = strpos($data, 'waitfor') !== false;
     $this->_writefile = strpos($data, 'writefile') !== false;
     $this->_dtmf = strpos($data, 'dtmf') !== false;
     if ($this->_dtmf) {
         $this->_digits = chr($result->getResult());
     }
     if ($this->_writefile || $this->_waitfor) {
         throw new RecordException($data);
     }
     $data = explode('=', $data);
     if (isset($data[1])) {
         $this->_endpos = $data[1];
     }
 }
示例#3
0
 /**
  * Constructor.
  *
  * @param IResult $result Result to decorate.
  *
  * @return void
  */
 public function __construct(IResult $result)
 {
     parent::__construct($result);
     $this->_digits = false;
     $this->_timeout = false;
     $result = $result->getResult();
     switch ($result) {
         case -1:
             throw new ChannelDownException();
             break;
         case 0:
             $this->_timeout = true;
             break;
         default:
             $this->_digits = chr(intval($result));
             break;
     }
 }