@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @author Egar Rizki <[email protected]> |
19 | 19 | */ |
20 | -class User implements UserInterface |
|
21 | -{ |
|
20 | +class User implements UserInterface |
|
21 | +{ |
|
22 | 22 | /** |
23 | 23 | * @var \Ch0c01dxyz\InstaToken\Objects\AccessToken |
24 | 24 | */ |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | * @param \Http\Client\HttpClient|null $httpClient |
41 | 41 | * @param \Http\Message\RequestFactory|null $requestFactory |
42 | 42 | */ |
43 | - public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
|
44 | - { |
|
43 | + public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
|
44 | + { |
|
45 | 45 | $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
46 | 46 | |
47 | 47 | $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @param string $token |
54 | 54 | */ |
55 | - public function setToken ( $token ) |
|
56 | - { |
|
55 | + public function setToken ( $token ) |
|
56 | + { |
|
57 | 57 | $this->accessToken = new AccessToken ( $token ); |
58 | 58 | } |
59 | 59 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | |
81 | 81 | $response = $this->httpClient->sendRequest ( $request ); |
82 | 82 | |
83 | - if ( $response->getStatusCode () === 400 ) |
|
84 | - { |
|
83 | + if ( $response->getStatusCode () === 400 ) |
|
84 | + { |
|
85 | 85 | $body = json_decode ( ( string ) $response->getBody () ); |
86 | 86 | |
87 | 87 | throw new UserException ( $body->meta->error_message ); |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function getInfo ( UserId $userId ) : array |
99 | 99 | { |
100 | - if ( false === ( $userId instanceof UserId ) ) |
|
101 | - { |
|
100 | + if ( false === ( $userId instanceof UserId ) ) |
|
101 | + { |
|
102 | 102 | throw new UserException ( "Current param isn't instance of UserId." ); |
103 | 103 | } |
104 | 104 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | |
109 | 109 | $response = $this->httpClient->sendRequest ( $request ); |
110 | 110 | |
111 | - if ( $response->getStatusCode () === 400 ) |
|
112 | - { |
|
111 | + if ( $response->getStatusCode () === 400 ) |
|
112 | + { |
|
113 | 113 | $body = json_decode ( ( string ) $response->getBody () ); |
114 | 114 | |
115 | 115 | throw new UserException ( $body->meta->error_message ); |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | $response = $this->httpClient->sendRequest ( $request ); |
133 | 133 | |
134 | - if ( $response->getStatusCode () === 400 ) |
|
135 | - { |
|
134 | + if ( $response->getStatusCode () === 400 ) |
|
135 | + { |
|
136 | 136 | $body = json_decode ( ( string ) $response->getBody () ); |
137 | 137 | |
138 | 138 | throw new UserException ( $body->meta->error_message ); |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | |
155 | 155 | $response = $this->httpClient->sendRequest ( $request ); |
156 | 156 | |
157 | - if ( $response->getStatusCode () === 400 ) |
|
158 | - { |
|
157 | + if ( $response->getStatusCode () === 400 ) |
|
158 | + { |
|
159 | 159 | $body = json_decode ( ( string ) $response->getBody () ); |
160 | 160 | |
161 | 161 | throw new UserException ( $body->meta->error_message ); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function searchUser ( Name $name ) : array |
174 | 174 | { |
175 | - if ( false === ( $name instanceof Name ) ) |
|
176 | - { |
|
175 | + if ( false === ( $name instanceof Name ) ) |
|
176 | + { |
|
177 | 177 | throw new UserException ( "Current param isn't instance of Name Class." ); |
178 | 178 | } |
179 | 179 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | |
184 | 184 | $response = $this->httpClient->sendRequest ( $request ); |
185 | 185 | |
186 | - if ( $response->getStatusCode () === 400 ) |
|
187 | - { |
|
186 | + if ( $response->getStatusCode () === 400 ) |
|
187 | + { |
|
188 | 188 | $body = json_decode ( ( string ) $response->getBody () ); |
189 | 189 | |
190 | 190 | throw new UserException ( $body->meta->error_message ); |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function readUserMedia ( UserId $userId ) : array |
202 | 202 | { |
203 | - if ( false === ( $userId instanceof UserId ) ) |
|
204 | - { |
|
203 | + if ( false === ( $userId instanceof UserId ) ) |
|
204 | + { |
|
205 | 205 | throw new UserException ( "Current param isn't instance of UserId Class." ); |
206 | 206 | } |
207 | 207 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | |
212 | 212 | $response = $this->httpClient->sendRequest ( $request ); |
213 | 213 | |
214 | - if ( $response->getStatusCode () === 400 ) |
|
215 | - { |
|
214 | + if ( $response->getStatusCode () === 400 ) |
|
215 | + { |
|
216 | 216 | $body = json_decode ( ( string ) $response->getBody () ); |
217 | 217 | |
218 | 218 | throw new UserException ( $body->meta->error_message ); |