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: use SMSApi\Exception\InvalidParameterException;
  6: 
  7: /**
  8:  * Class ContactResponse
  9:  * @package SMSApi\Api\Response
 10:  */
 11: class ContactResponse extends AbstractResponse {
 12: 
 13:     const GENDER_FEMALE = "female";
 14:     const GENDER_MALE = "male";
 15: 
 16:     /**
 17:      * @var int
 18:      */
 19:     private $number;
 20: 
 21:     /**
 22:      * @var string
 23:      */
 24:     private $firstName;
 25: 
 26:     /**
 27:      * @var string
 28:      */
 29:     private $lastName;
 30: 
 31:     /**
 32:      * @var string
 33:      */
 34:     private $info;
 35: 
 36:     /**
 37:      * @var string
 38:      */
 39:     private $email;
 40: 
 41:     /**
 42:      * @var string
 43:      */
 44:     private $birthday;
 45: 
 46:     /**
 47:      * @var string
 48:      */
 49:     private $city;
 50: 
 51:     /**
 52:      * @var string
 53:      */
 54:     private $gender;
 55: 
 56:     /**
 57:      * @var int
 58:      */
 59:     private $dateAdd;
 60: 
 61:     /**
 62:      * @var int
 63:      */
 64:     private $dateMod;
 65: 
 66:     /**
 67:      * @var array
 68:      */
 69:     private $groups = null;
 70: 
 71:     public function __construct( $data ) {
 72: 
 73:         if ( is_object( $data ) ) {
 74:             $this->obj = $data;
 75:         } else if ( is_string( $data ) ) {
 76:             parent::__construct( $data );
 77:         }
 78: 
 79:         if ( isset( $this->obj->number ) ) {
 80:             $this->number = $this->obj->number;
 81:         }
 82: 
 83:         if ( isset( $this->obj->first_name ) ) {
 84:             $this->firstName = $this->obj->first_name;
 85:         }
 86: 
 87:         if ( isset( $this->obj->last_name ) ) {
 88:             $this->lastName = $this->obj->last_name;
 89:         }
 90: 
 91:         if ( isset( $this->obj->info ) ) {
 92:             $this->info = $this->obj->info;
 93:         }
 94: 
 95:         if ( isset( $this->obj->birthday ) ) {
 96:             $this->birthday = $this->obj->birthday;
 97:         }
 98: 
 99:         if ( isset( $this->obj->city ) ) {
100:             $this->city = $this->obj->city;
101:         }
102: 
103:         if ( isset( $this->obj->gender ) ) {
104:             $this->gender = $this->obj->gender;
105:         }
106: 
107:         if ( isset( $this->obj->date_add ) ) {
108:             $this->dateAdd = $this->obj->date_add;
109:         }
110: 
111:         if ( isset( $this->obj->date_mod ) ) {
112:             $this->dateMod = $this->obj->date_mod;
113:         }
114: 
115:         if (isset($this->obj->groups)) {
116:             $this->groups = (array)$this->obj->groups;
117:         }
118:     }
119: 
120:     /**
121:      * Returns phone number
122:      *
123:      * @return int
124:      */
125:     public function getNumber() {
126:         return $this->number;
127:     }
128: 
129:     /**
130:      * Returns contact first name
131:      *
132:      * @return string
133:      */
134:     public function getFirstName() {
135:         return $this->firstName;
136:     }
137: 
138:     /**
139:      * Returns contact last name
140:      *
141:      * @return string
142:      */
143:     public function getLastName() {
144:         return $this->lastName;
145:     }
146: 
147:     /**
148:      * Returns contact information text
149:      *
150:      * @return string
151:      */
152:     public function getInfo() {
153:         return $this->info;
154:     }
155: 
156:     /**
157:      * Returns contact e-mail address
158:      *
159:      * @return string Example: example@smsapi.com
160:      */
161:     public function getEmail() {
162:         return $this->email;
163:     }
164: 
165:     /**
166:      * Returns contact birthday date
167:      *
168:      * @return string Example: 1974-1-14
169:      */
170:     public function getBirthday() {
171:         return $this->birthday;
172:     }
173: 
174:     /**
175:      * Returns contact city name
176:      *
177:      * @return string
178:      */
179:     public function getCity() {
180:         return $this->city;
181:     }
182: 
183:     /**
184:      * Returns contact gender
185:      *
186:      * @see \SMSApi\Api\Response\ContactResponse::GENDER_FEMALE
187:      * @see \SMSApi\Api\Response\ContactResponse::GENDER_MALE
188:      * @return string Example male or female
189:      */
190:     public function getGender() {
191:         return $this->gender;
192:     }
193: 
194:     /**
195:      * Returns create date in timestamp
196:      *
197:      * @return int date in timestamp
198:      */
199:     public function getDateAdd() {
200:         return $this->dateAdd;
201:     }
202: 
203:     /**
204:      * Returns modification date in timestamp
205:      *
206:      * @return int date in timestamp
207:      */
208:     public function getDateMod() {
209:         return $this->dateMod;
210:     }
211: 
212:     /**
213:      * Returns groups
214:      *
215:      * @throws InvalidParameterException
216:      * @return array with group names
217:      */
218:     public function getGroups()
219:     {
220: 
221:         if ($this->groups === null) {
222:             throw new InvalidParameterException('Use action \SMSApi\Api\Action\Phonebook\ContactGet::withGroups() method to load resources with groups');
223:         }
224: 
225:         return $this->groups;
226:     }
227: 
228: 
229: 
230: }
231: 
SMSAPI Api Client API documentation generated by ApiGen