1: <?php
2:
3: namespace SMSApi\Api\Response;
4:
5: /**
6: * Class UserResponse
7: * @package SMSApi\Api\Response
8: */
9: class UserResponse extends AbstractResponse {
10:
11: /**
12: * @var string
13: */
14: private $username;
15:
16: /**
17: * @var double
18: */
19: private $limit;
20:
21: /**
22: * @var double
23: */
24: private $monthLimit;
25:
26: /**
27: * @var
28: */
29: private $senders;
30:
31: /**
32: * @var int
33: */
34: private $phonebook;
35:
36: /**
37: * @var int
38: */
39: private $active;
40:
41: /**
42: * @var string
43: */
44: private $info;
45:
46: /**
47: * @param $data
48: */
49: function __construct( $data ) {
50:
51: if ( is_object( $data ) ) {
52: $this->obj = $data;
53: } else if ( is_string( $data ) ) {
54: parent::__construct( $data );
55: }
56:
57: if ( isset( $this->obj->username ) ) {
58: $this->username = $this->obj->username;
59: }
60:
61: if ( isset( $this->obj->limit ) ) {
62: $this->limit = $this->obj->limit;
63: }
64:
65: if ( isset( $this->obj->month_limit ) ) {
66: $this->monthLimit = $this->obj->month_limit;
67: }
68:
69: if ( isset( $this->obj->senders ) ) {
70: $this->senders = $this->obj->senders;
71: }
72:
73: if ( isset( $this->obj->phonebook ) ) {
74: $this->phonebook = $this->obj->phonebook;
75: }
76:
77: if ( isset( $this->obj->active ) ) {
78: $this->active = $this->obj->active;
79: }
80:
81: if ( isset( $this->obj->info ) ) {
82: $this->info = $this->obj->info;
83: }
84: }
85:
86: /**
87: * Returns the username used to authenticate the user.
88: *
89: * @return string The username
90: */
91: public function getUsername() {
92: return $this->username;
93: }
94:
95: /**
96: * Returns limit points assigned to the user.
97: *
98: * @return double Points limit
99: */
100: public function getLimit() {
101: return $this->limit;
102: }
103:
104: /**
105: * Returns number of points that will be assigned to user account each first day of month.
106: *
107: * @return double Monthly points limit
108: */
109: public function getMonthLimit() {
110: return $this->monthLimit;
111: }
112:
113: /**
114: * @deprecated since v1.0.0 use UserResponse::hasFullAccessSenderNames
115: * @return mixed
116: */
117: public function getSenders() {
118: return $this->senders;
119: }
120:
121: /**
122: * Returns whether the user has access to main account sender names.
123: *
124: * @return bool true if the user has access, false otherwise
125: */
126: public function hasFullAccessSenderNames() {
127: return (bool) $this->senders;
128: }
129:
130: /**
131: * @deprecated since v1.0.0
132: * @return int
133: */
134: public function getPhonebook() {
135: return $this->phonebook;
136: }
137:
138: /**
139: * Returns whether the user has access to main account phonebook contacts
140: *
141: * @return bool true if the user has access, false otherwise
142: */
143: public function hasFullAccessPhoneBook() {
144: return (bool)$this->phonebook;
145: }
146:
147: /**
148: * @deprecated since v1.0.0
149: * @return int
150: */
151: public function getActive() {
152: return $this->active;
153: }
154:
155: /**
156: * Check whether the user is enabled.
157: *
158: * @return Boolean true if the user is enabled, false otherwise
159: */
160: public function isActive() {
161: return (bool) $this->active;
162: }
163:
164: /**
165: * Returns user description text.
166: *
167: * @return string
168: */
169: public function getInfo() {
170: return $this->info;
171: }
172:
173: }
174: