@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @param string $path |
| 251 | 251 | * @param array $parameters |
| 252 | 252 | * |
| 253 | - * @param array $headers |
|
| 253 | + * @param string[] $headers |
|
| 254 | 254 | * @return Response |
| 255 | 255 | */ |
| 256 | 256 | public function post($path, array $parameters = [], array $headers = []) |
@@ -648,6 +648,10 @@ discard block |
||
| 648 | 648 | // This function takes a input like a=b&a=c&d=e and returns the parsed |
| 649 | 649 | // parameters like this |
| 650 | 650 | // array('a' => array('b','c'), 'd' => 'e') |
| 651 | + |
|
| 652 | + /** |
|
| 653 | + * @param string $input |
|
| 654 | + */ |
|
| 651 | 655 | public static function parse_parameters($input) |
| 652 | 656 | { |
| 653 | 657 | if (!isset($input) || !$input) { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | if ($parameters['media_type'] == 'video/mp4') { |
| 332 | 332 | $parameters['media_category'] = "amplify_video"; |
| 333 | - } elseif($parameters['media_type'] == 'image/gif'){ |
|
| 333 | + } elseif ($parameters['media_type'] == 'image/gif') { |
|
| 334 | 334 | $parameters['media_category'] = 'tweet_gif'; |
| 335 | 335 | } |
| 336 | 336 | |
@@ -413,10 +413,10 @@ discard block |
||
| 413 | 413 | $this->method = $method; |
| 414 | 414 | $this->resource = $path; |
| 415 | 415 | $this->resetLastResponse(); |
| 416 | - if(strpos($path, TONUpload::DEFAULT_DOMAIN) === 0) { |
|
| 416 | + if (strpos($path, TONUpload::DEFAULT_DOMAIN) === 0) { |
|
| 417 | 417 | $url = $path; |
| 418 | 418 | } else { |
| 419 | - if($host == self::UPLOAD_HOST){ |
|
| 419 | + if ($host == self::UPLOAD_HOST) { |
|
| 420 | 420 | $url = sprintf('%s/%s/%s', $host, self::API_REST_VERSION, $path); |
| 421 | 421 | } else { |
| 422 | 422 | $url = sprintf('%s/%s/%s', $host, self::API_VERSION, $path); |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * @throws ServerError |
| 444 | 444 | * @throws ServiceUnavailable |
| 445 | 445 | */ |
| 446 | - public function manageErrors($response){ |
|
| 446 | + public function manageErrors($response) { |
|
| 447 | 447 | switch ($this->getLastHttpCode()) { |
| 448 | 448 | case 400: |
| 449 | 449 | throw new BadRequest(TwitterAdsException::BAD_REQUEST, 400, null, $response->errors); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } else { |
| 490 | 490 | $authorization = 'Authorization: Bearer '.$this->bearer; |
| 491 | 491 | } |
| 492 | - if(strpos($url, TONUpload::DEFAULT_DOMAIN) === 0) { |
|
| 492 | + if (strpos($url, TONUpload::DEFAULT_DOMAIN) === 0) { |
|
| 493 | 493 | return $this->request($url, $method, $authorization, $parameters, $headers); |
| 494 | 494 | } else { |
| 495 | 495 | return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters, $headers); |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | CURLOPT_CAINFO => __DIR__.DIRECTORY_SEPARATOR.'cacert.pem', |
| 518 | 518 | CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout, |
| 519 | 519 | CURLOPT_HEADER => true, |
| 520 | - CURLOPT_HTTPHEADER => array_merge(['Accept: */*', $authorization, 'Expect:'],$headers,['Connection: close']), |
|
| 520 | + CURLOPT_HTTPHEADER => array_merge(['Accept: */*', $authorization, 'Expect:'], $headers, ['Connection: close']), |
|
| 521 | 521 | CURLOPT_RETURNTRANSFER => true, |
| 522 | 522 | CURLOPT_SSL_VERIFYHOST => 2, |
| 523 | 523 | CURLOPT_SSL_VERIFYPEER => true, |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | break; |
| 541 | 541 | case 'POST': |
| 542 | 542 | $options[CURLOPT_POST] = true; |
| 543 | - if(isset($postfields['raw'])){ |
|
| 543 | + if (isset($postfields['raw'])) { |
|
| 544 | 544 | $options[CURLOPT_POSTFIELDS] = $postfields['raw']; |
| 545 | 545 | } else { |
| 546 | 546 | $options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields); |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | break; |
| 553 | 553 | case 'PUT': |
| 554 | 554 | $options[CURLOPT_CUSTOMREQUEST] = 'PUT'; |
| 555 | - if(isset($postfields['raw'])){ |
|
| 555 | + if (isset($postfields['raw'])) { |
|
| 556 | 556 | $options[CURLOPT_POSTFIELDS] = $postfields['raw']; |
| 557 | 557 | } |
| 558 | 558 | break; |
@@ -717,9 +717,9 @@ discard block |
||
| 717 | 717 | $token = $token['oauth_token']; |
| 718 | 718 | } |
| 719 | 719 | if (empty($sign_in_with_twitter)) { |
| 720 | - return $this->authorizeURL() . "?oauth_token={$token}"; |
|
| 720 | + return $this->authorizeURL()."?oauth_token={$token}"; |
|
| 721 | 721 | } else { |
| 722 | - return $this->authenticateURL() . "?oauth_token={$token}"; |
|
| 722 | + return $this->authenticateURL()."?oauth_token={$token}"; |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |