/** * 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'); } }
/** * 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]; } }
/** * 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; } }