@@ -29,14 +29,19 @@ discard block  | 
                                                    ||
| 29 | 29 | * e.g. [CURLOPT_USERAGENT => 'abc'],  | 
                                                        
| 30 | 30 | * ['CURLOPT_USERAGENT' => 'abc']  | 
                                                        
| 31 | 31 | *  | 
                                                        
| 32 | - * @param bool $assoc  | 
                                                        |
| 33 | - * Use Assoc-style or not.  | 
                                                        |
| 34 | 32 | *  | 
                                                        
| 35 | - * @param bool $stringify  | 
                                                        |
| 36 | - * Stringify CURLOPT_* constant names or not.  | 
                                                        |
| 33 | + * @return void  | 
                                                        |
| 37 | 34 | */  | 
                                                        
| 38 | 35 | public function __construct(array $credentials, array $options = []);  | 
                                                        
| 36 | +  | 
                                                        |
| 37 | + /**  | 
                                                        |
| 38 | + * @return Traits\BaseClientTrait  | 
                                                        |
| 39 | + */  | 
                                                        |
| 39 | 40 | public function withCredentials(array $credentails); // : ClientInterface  | 
                                                        
| 41 | +  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * @return Traits\BaseClientTrait  | 
                                                        |
| 44 | + */  | 
                                                        |
| 40 | 45 | public function withOptions(array $options); // : ClientInterface  | 
                                                        
| 41 | 46 | public function getCredentials($assoc = false); // : array  | 
                                                        
| 42 | 47 | public function getOptions($stringify = false); // : array  | 
                                                        
@@ -45,15 +50,12 @@ discard block  | 
                                                    ||
| 45 | 50 | * Retrive part of credentials using magic methods or ArrayAccess interface.  | 
                                                        
| 46 | 51 | *  | 
                                                        
| 47 | 52 | * @param string $key  | 
                                                        
| 48 | - * @param string $offset  | 
                                                        |
| 49 | - *  | 
                                                        |
| 50 | - * e.g.  | 
                                                        |
| 51 | - * $a = $client->consumer_key;  | 
                                                        |
| 52 | - * $b = $client['consumer_secret'];  | 
                                                        |
| 53 | - * $c = $client[2];  | 
                                                        |
| 54 | - * $d = $client->tokenSecret;  | 
                                                        |
| 55 | 53 | */  | 
                                                        
| 56 | 54 | public function __get($key); // : string  | 
                                                        
| 55 | +  | 
                                                        |
| 56 | + /**  | 
                                                        |
| 57 | + * @return boolean  | 
                                                        |
| 58 | + */  | 
                                                        |
| 57 | 59 | public function __isset($key); // : boolean  | 
                                                        
| 58 | 60 | public function offsetGet($offset); // : string  | 
                                                        
| 59 | 61 | public function offsetExists($offset); // : boolean  | 
                                                        
@@ -71,18 +73,31 @@ discard block  | 
                                                    ||
| 71 | 73 | * login() uses scraping.  | 
                                                        
| 72 | 74 | *  | 
                                                        
| 73 | 75 | * @param string|null $oauth_callback Callback URL or "oob".  | 
                                                        
| 74 | - * @param string $oauth_verifier  | 
                                                        |
| 75 | - * @param string $username Username or email.  | 
                                                        |
| 76 | - * @param string $password  | 
                                                        |
| 77 | 76 | * @throws HttpExceptionInterface  | 
                                                        
| 78 | 77 | */  | 
                                                        
| 79 | 78 | public function oauthForRequestToken($oauth_callback = null); // : ClientInterface  | 
                                                        
| 80 | 79 | public function oauthForAccessToken($oauth_verifier); // : ClientInterface  | 
                                                        
| 81 | 80 | public function xauthForAccessToken($username, $password); // : ClientInterface  | 
                                                        
| 82 | 81 | public function login($username, $password); // : ClientInterface  | 
                                                        
| 82 | +  | 
                                                        |
| 83 | + /**  | 
                                                        |
| 84 | + * @return \Generator  | 
                                                        |
| 85 | + */  | 
                                                        |
| 83 | 86 | public function oauthForRequestTokenAsync($oauth_callback = null); // : \Generator<ClientInterface>  | 
                                                        
| 87 | +  | 
                                                        |
| 88 | + /**  | 
                                                        |
| 89 | + * @return \Generator  | 
                                                        |
| 90 | + */  | 
                                                        |
| 84 | 91 | public function oauthForAccessTokenAsync($oauth_verifier); // : \Generator<ClientInterface>  | 
                                                        
| 92 | +  | 
                                                        |
| 93 | + /**  | 
                                                        |
| 94 | + * @return \Generator  | 
                                                        |
| 95 | + */  | 
                                                        |
| 85 | 96 | public function xauthForAccessTokenAsync($username, $password); // : \Generator<ClientInterface>  | 
                                                        
| 97 | +  | 
                                                        |
| 98 | + /**  | 
                                                        |
| 99 | + * @return \Generator  | 
                                                        |
| 100 | + */  | 
                                                        |
| 86 | 101 | public function loginAsync($username, $password); // : \Generator<ClientInterface>  | 
                                                        
| 87 | 102 | |
| 88 | 103 | /**  | 
                                                        
@@ -107,8 +122,20 @@ discard block  | 
                                                    ||
| 107 | 122 | public function get($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface  | 
                                                        
| 108 | 123 | public function post($endpoint, array $params = [], $return_response_object = false); // : \stdClass|null|ResponseInterface  | 
                                                        
| 109 | 124 | public function postMultipart($endpoint, array $params = [], $return_response_object = false); // : \stdClass|null|ResponseInterface  | 
                                                        
| 125 | +  | 
                                                        |
| 126 | + /**  | 
                                                        |
| 127 | + * @return \Generator  | 
                                                        |
| 128 | + */  | 
                                                        |
| 110 | 129 | public function getAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface  | 
                                                        
| 130 | +  | 
                                                        |
| 131 | + /**  | 
                                                        |
| 132 | + * @return \Generator  | 
                                                        |
| 133 | + */  | 
                                                        |
| 111 | 134 | public function postAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|null|ResponseInterface>  | 
                                                        
| 135 | +  | 
                                                        |
| 136 | + /**  | 
                                                        |
| 137 | + * @return \Generator  | 
                                                        |
| 138 | + */  | 
                                                        |
| 112 | 139 | public function postMultipartAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|null|ResponseInterface>  | 
                                                        
| 113 | 140 | |
| 114 | 141 | /**  | 
                                                        
@@ -132,8 +159,20 @@ discard block  | 
                                                    ||
| 132 | 159 | public function getOut($url, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface  | 
                                                        
| 133 | 160 | public function postOut($url, array $params = [], $return_response_object = false); // : \stdClass|null|ResponseInterface  | 
                                                        
| 134 | 161 | public function postMultipartOut($url, array $params = [], $return_response_object = false); // : \stdClass|null|ResponseInterface  | 
                                                        
| 162 | +  | 
                                                        |
| 163 | + /**  | 
                                                        |
| 164 | + * @return \Generator  | 
                                                        |
| 165 | + */  | 
                                                        |
| 135 | 166 | public function getOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface  | 
                                                        
| 167 | +  | 
                                                        |
| 168 | + /**  | 
                                                        |
| 169 | + * @return \Generator  | 
                                                        |
| 170 | + */  | 
                                                        |
| 136 | 171 | public function postOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|null|ResponseInterface>  | 
                                                        
| 172 | +  | 
                                                        |
| 173 | + /**  | 
                                                        |
| 174 | + * @return \Generator  | 
                                                        |
| 175 | + */  | 
                                                        |
| 137 | 176 | public function postMultipartOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|null|ResponseInterface>  | 
                                                        
| 138 | 177 | |
| 139 | 178 | /**  | 
                                                        
@@ -160,8 +199,13 @@ discard block  | 
                                                    ||
| 160 | 199 | * Signature: function (ResponseInterface $response);  | 
                                                        
| 161 | 200 | *  | 
                                                        
| 162 | 201 | * @throws HttpExceptionInterface  | 
                                                        
| 202 | + * @return void  | 
                                                        |
| 163 | 203 | */  | 
                                                        
| 164 | 204 | public function streaming($endpoint, callable $event_handler, array $params = [], callable $header_response_handler = null); // : null  | 
                                                        
| 205 | +  | 
                                                        |
| 206 | + /**  | 
                                                        |
| 207 | + * @return \Generator  | 
                                                        |
| 208 | + */  | 
                                                        |
| 165 | 209 | public function streamingAsync($endpoint, callable $event_handler, array $params = [], callable $header_response_handler = null); // : \Generator<null>  | 
                                                        
| 166 | 210 | |
| 167 | 211 | /**  | 
                                                        
@@ -183,10 +227,23 @@ discard block  | 
                                                    ||
| 183 | 227 | * File data is split into chunks with specified size.  | 
                                                        
| 184 | 228 | *  | 
                                                        
| 185 | 229 | * @throws HttpExceptionInterface  | 
                                                        
| 230 | + * @return \Generator  | 
                                                        |
| 186 | 231 | */  | 
                                                        
| 187 | 232 | public function uploadAsync(\SplFileObject $file, $media_category = null, callable $on_progress = null, $chunk_size = 300000); // : \Generator<\stdClass>  | 
                                                        
| 233 | +  | 
                                                        |
| 234 | + /**  | 
                                                        |
| 235 | + * @return \Generator  | 
                                                        |
| 236 | + */  | 
                                                        |
| 188 | 237 | public function uploadImageAsync(\SplFileObject $file, callable $on_progress = null, $chunk_size = 300000); // : \Generator<\stdClass>  | 
                                                        
| 238 | +  | 
                                                        |
| 239 | + /**  | 
                                                        |
| 240 | + * @return \Generator  | 
                                                        |
| 241 | + */  | 
                                                        |
| 189 | 242 | public function uploadAnimeGifAsync(\SplFileObject $file, callable $on_progress = null, $chunk_size = 300000); // : \Generator<\stdClass>  | 
                                                        
| 243 | +  | 
                                                        |
| 244 | + /**  | 
                                                        |
| 245 | + * @return \Generator  | 
                                                        |
| 246 | + */  | 
                                                        |
| 190 | 247 | public function uploadVideoAsync(\SplFileObject $file, callable $on_progress = null, $chunk_size = 300000); // : \Generator<\stdClass>  | 
                                                        
| 191 | 248 | |
| 192 | 249 | /**  | 
                                                        
@@ -195,14 +252,23 @@ discard block  | 
                                                    ||
| 195 | 252 | * @throws HttpExceptionInterface  | 
                                                        
| 196 | 253 | */  | 
                                                        
| 197 | 254 | public function oauthForBearerToken(); // : ClientInterface  | 
                                                        
| 255 | +  | 
                                                        |
| 256 | + /**  | 
                                                        |
| 257 | + * @return \Generator  | 
                                                        |
| 258 | + */  | 
                                                        |
| 198 | 259 | public function oauthForBearerTokenAsync(); // : \Generator<ClientInterface>  | 
                                                        
| 199 | 260 | |
| 200 | 261 | /**  | 
                                                        
| 201 | 262 | * Invalidate OAuth 2.0 token.  | 
                                                        
| 202 | 263 | *  | 
                                                        
| 203 | 264 | * @throws HttpExceptionInterface  | 
                                                        
| 265 | + * @return void  | 
                                                        |
| 204 | 266 | */  | 
                                                        
| 205 | 267 | public function invalidateBearerToken(); // : null  | 
                                                        
| 268 | +  | 
                                                        |
| 269 | + /**  | 
                                                        |
| 270 | + * @return \Generator  | 
                                                        |
| 271 | + */  | 
                                                        |
| 206 | 272 | public function invalidateBearerTokenAsync(); // : \Generator<null>  | 
                                                        
| 207 | 273 | |
| 208 | 274 | /**  | 
                                                        
@@ -223,5 +289,9 @@ discard block  | 
                                                    ||
| 223 | 289 | * @throws HttpExceptionInterface  | 
                                                        
| 224 | 290 | */  | 
                                                        
| 225 | 291 | public function get2($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface  | 
                                                        
| 292 | +  | 
                                                        |
| 293 | + /**  | 
                                                        |
| 294 | + * @return \Generator  | 
                                                        |
| 295 | + */  | 
                                                        |
| 226 | 296 | public function get2Async($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface>  | 
                                                        
| 227 | 297 | }  | 
                                                        
@@ -36,6 +36,9 @@  | 
                                                    ||
| 36 | 36 | return strlen($str);  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | + /**  | 
                                                        |
| 40 | + * @param string $line  | 
                                                        |
| 41 | + */  | 
                                                        |
| 39 | 42 | protected function processLine($ch, $line)  | 
                                                        
| 40 | 43 |      { | 
                                                        
| 41 | 44 | $handle = $this->eventHandler;  | 
                                                        
@@ -9,10 +9,20 @@ discard block  | 
                                                    ||
| 9 | 9 | |
| 10 | 10 | trait UploaderTrait  | 
                                                        
| 11 | 11 |  { | 
                                                        
| 12 | + /**  | 
                                                        |
| 13 | + * @param string $endpoint  | 
                                                        |
| 14 | + */  | 
                                                        |
| 12 | 15 | abstract public function getAsync($endpoint, array $params = [], $return_response_object = false);  | 
                                                        
| 16 | +  | 
                                                        |
| 17 | + /**  | 
                                                        |
| 18 | + * @param string $endpoint  | 
                                                        |
| 19 | + */  | 
                                                        |
| 13 | 20 | abstract public function postAsync($endpoint, array $params = [], $return_response_object = false);  | 
                                                        
| 14 | 21 | abstract public function postMultipartAsync($endpoint, array $params = [], $return_response_object = false);  | 
                                                        
| 15 | 22 | |
| 23 | + /**  | 
                                                        |
| 24 | + * @param integer $value  | 
                                                        |
| 25 | + */  | 
                                                        |
| 16 | 26 | protected static function validateChunkSize($value)  | 
                                                        
| 17 | 27 |      { | 
                                                        
| 18 | 28 |          if (false === $value = filter_var($value, FILTER_VALIDATE_INT)) { | 
                                                        
@@ -32,6 +42,9 @@ discard block  | 
                                                    ||
| 32 | 42 | return $type;  | 
                                                        
| 33 | 43 | }  | 
                                                        
| 34 | 44 | |
| 45 | + /**  | 
                                                        |
| 46 | + * @param string $media_category  | 
                                                        |
| 47 | + */  | 
                                                        |
| 35 | 48 | public function uploadAsync(\SplFileObject $file, $media_category = null, callable $on_uploading = null, callable $on_processing = null, $chunk_size = 300000)  | 
                                                        
| 36 | 49 |      { | 
                                                        
| 37 | 50 | $response = (yield $this->uploadStep1($file, $media_category, $chunk_size, $on_uploading));  |