Overview

Namespaces

  • SMSApi
    • Api
      • Action
        • Phonebook
        • Sender
        • Sms
        • User
      • Response
    • Exception
    • Proxy
      • Http

Classes

  • SMSApi\Proxy\Http\AbstractHttp
  • SMSApi\Proxy\Http\Curl
  • SMSApi\Proxy\Http\Native
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace SMSApi\Api\Response;
 4: 
 5: /**
 6:  * Class AbstractResponse
 7:  * @package SMSApi\Api\Response
 8:  */
 9: abstract class AbstractResponse implements Response {
10: 
11:     /**
12:      * @var mixed
13:      */
14:     protected $obj;
15: 
16:     /**
17:      * @param $data
18:      */
19:     function __construct( $data ) {
20:         $this->obj = $this->decode($data);
21:     }
22: 
23:     /**
24:      * @param $string
25:      * @return mixed
26:      * @throws \SMSApi\Exception\SmsapiException
27:      */
28:     protected function decode($string) {
29: 
30:         $result = json_decode($string);
31: 
32:         if( $result === null ) {
33:             throw new \SMSApi\Exception\SmsapiException("error json: ".json_last_error());
34:         }
35: 
36:         return $result;
37:     }
38: 
39: }
40: 
SMSAPI Api Client API documentation generated by ApiGen