[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Service/DeveloperGarden/Response/VoiceButler/ -> VoiceButlerAbstract.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to the new BSD license that is bundled
   8   * with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://framework.zend.com/license/new-bsd
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Service
  17   * @subpackage DeveloperGarden
  18   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   * @version    $Id$
  21   */
  22  
  23  /**
  24   * @see Zend_Service_DeveloperGarden_Response_ResponseAbstract
  25   */
  26  require_once 'Zend/Service/DeveloperGarden/Response/ResponseAbstract.php';
  27  
  28  /**
  29   * @category   Zend
  30   * @package    Zend_Service
  31   * @subpackage DeveloperGarden
  32   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33   * @author     Marco Kaiser
  34   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  35   */
  36  abstract class Zend_Service_DeveloperGarden_Response_VoiceButler_VoiceButlerAbstract
  37      extends Zend_Service_DeveloperGarden_Response_ResponseAbstract
  38  {
  39      /**
  40       * the return from the sms request
  41       *
  42       * @var stdClass
  43       */
  44      public $return = null;
  45  
  46      /**
  47       * returns the return object
  48       *
  49       * @return stdClass
  50       */
  51      public function getReturn()
  52      {
  53          return $this->return;
  54      }
  55  
  56      /**
  57       * parse the response data and throws exceptions
  58       *
  59       * @throws Zend_Service_DeveloperGarden_Response_Exception
  60       * @return Zend_Service_DeveloperGarden_Response_ResponseAbstract
  61       */
  62      public function parse()
  63      {
  64          if ($this->hasError()) {
  65              throw new Zend_Service_DeveloperGarden_Response_Exception(
  66                  $this->getErrorMessage(),
  67                  $this->getErrorCode()
  68              );
  69          }
  70  
  71          return $this;
  72      }
  73  
  74      /**
  75       * returns the error code
  76       *
  77       * @return string|null
  78       */
  79      public function getErrorCode()
  80      {
  81          $retValue = null;
  82          if ($this->return instanceof stdClass) {
  83              $retValue = $this->return->status;
  84          }
  85          return $retValue;
  86      }
  87  
  88      /**
  89       * returns the error message
  90       *
  91       * @return string
  92       */
  93      public function getErrorMessage()
  94      {
  95          $retValue = null;
  96          if ($this->return instanceof stdClass) {
  97              $retValue = $this->return->err_msg;
  98          }
  99          return $retValue;
 100      }
 101  
 102      /**
 103       * returns true if the errorCode is not null and not 0000
 104       *
 105       * @return boolean
 106       */
 107      public function isValid()
 108      {
 109          return ($this->return === null
 110                  || $this->return->status == '0000');
 111      }
 112  
 113      /**
 114       * returns true if we have a error situation
 115       *
 116       * @return boolean
 117       */
 118      public function hasError()
 119      {
 120          $retValue = false;
 121          if ($this->return instanceof stdClass
 122              && $this->return->status != '0000'
 123          ) {
 124              $retValue = true;
 125          }
 126          return $retValue;
 127      }
 128  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1