@@ -63,9 +63,9 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 65 | 65 | {
|
| 66 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 66 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 67 | 67 | |
| 68 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 68 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 69 | 69 | |
| 70 | 70 | $this->builder = new MultipartStreamBuilder (); |
| 71 | 71 | } |
@@ -42,9 +42,9 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 44 | 44 | {
|
| 45 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 45 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 46 | 46 | |
| 47 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 47 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -75,9 +75,9 @@ |
||
| 75 | 75 | |
| 76 | 76 | $this->appScope = ( string ) $appScope; |
| 77 | 77 | |
| 78 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 78 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 79 | 79 | |
| 80 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 80 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 44 | 44 | { |
| 45 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 45 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 46 | 46 | |
| 47 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 47 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | throw new UserException ( "Current param isn't instance of UserId." ); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $uri = sprintf ( "https://api.instagram.com/v1/users/%s/?access_token=%s", ( string ) $userId->__toInt(), $this->accessToken ); |
|
| 105 | + $uri = sprintf ( "https://api.instagram.com/v1/users/%s/?access_token=%s", ( string ) $userId->__toInt (), $this->accessToken ); |
|
| 106 | 106 | |
| 107 | 107 | $request = $this->requestFactory->createRequest ( "GET", $uri ); |
| 108 | 108 | |
@@ -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 ); |
@@ -63,9 +63,9 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 65 | 65 | {
|
| 66 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 66 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 67 | 67 | |
| 68 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 68 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 69 | 69 | |
| 70 | 70 | $this->builder = new MultipartStreamBuilder (); |
| 71 | 71 | } |
@@ -63,9 +63,9 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 65 | 65 | {
|
| 66 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 66 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 67 | 67 | |
| 68 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 68 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 69 | 69 | |
| 70 | 70 | $this->builder = new MultipartStreamBuilder (); |
| 71 | 71 | } |
@@ -42,9 +42,9 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 44 | 44 | {
|
| 45 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 45 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 46 | 46 | |
| 47 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 47 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -42,9 +42,9 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function __construct ( HttpClient $httpClient = null, RequestFactory $requestFactory = null ) |
| 44 | 44 | {
|
| 45 | - $this->httpClient = $httpClient ?: HttpClientDiscovery::find (); |
|
| 45 | + $this->httpClient = $httpClient ? : HttpClientDiscovery::find (); |
|
| 46 | 46 | |
| 47 | - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find (); |
|
| 47 | + $this->requestFactory = $requestFactory ? : MessageFactoryDiscovery::find (); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |