@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | * @param string $class The fully-qualified class name. |
| 7 | 7 | * @return void |
| 8 | 8 | */ |
| 9 | -spl_autoload_register(function ($class) { |
|
| 9 | +spl_autoload_register(function($class) { |
|
| 10 | 10 | |
| 11 | 11 | // project-specific namespace prefix |
| 12 | 12 | $prefix = 'Hborras\\TwitterAdsSDK\\'; |
| 13 | 13 | |
| 14 | 14 | // base directory for the namespace prefix |
| 15 | - $base_dir = __DIR__ . '/src/'; |
|
| 15 | + $base_dir = __DIR__.'/src/'; |
|
| 16 | 16 | |
| 17 | 17 | // does the class use the namespace prefix? |
| 18 | 18 | $len = strlen($prefix); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // replace the namespace prefix with the base directory, replace namespace |
| 28 | 28 | // separators with directory separators in the relative class name, append |
| 29 | 29 | // with .php |
| 30 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 30 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
| 31 | 31 | |
| 32 | 32 | // if the file exists, require it |
| 33 | 33 | if (file_exists($file)) { |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $line = fgets($file); |
| 30 | 30 | $normalized_email = strtolower(trim($line, " \t\r\n\0\x0B.")); |
| 31 | 31 | $normalized_email = hash('sha256', $normalized_email); |
| 32 | - fwrite($newFile, $normalized_email . "\n"); |
|
| 32 | + fwrite($newFile, $normalized_email."\n"); |
|
| 33 | 33 | # do same stuff with the $line |
| 34 | 34 | } |
| 35 | 35 | fclose($newFile); |
@@ -26,4 +26,4 @@ |
||
| 26 | 26 | |
| 27 | 27 | // create request for a simple nullcasted tweet |
| 28 | 28 | $media = $twitterAds->upload(['media' => 'twitter-gif.gif', 'media_type' => 'image/gif'], true); |
| 29 | -$tweet = Tweet::create($account, 'Tweet with chunked upload GIF...' . rand() . ' http://twitter.com', ['media_ids' => $media->media_id]); |
|
| 30 | 29 | \ No newline at end of file |
| 30 | +$tweet = Tweet::create($account, 'Tweet with chunked upload GIF...'.rand().' http://twitter.com', ['media_ids' => $media->media_id]); |
|
| 31 | 31 | \ No newline at end of file |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // create request for a simple nullcasted tweet |
| 48 | 48 | $media = $twitterAds->upload(['media' => 'kitten.jpg']); |
| 49 | -$tweet1 = Tweet::create($account, 'Tweet number 1 ...' . rand() . ' http://twitter.com', ['media_ids' => $media->media_id]); |
|
| 49 | +$tweet1 = Tweet::create($account, 'Tweet number 1 ...'.rand().' http://twitter.com', ['media_ids' => $media->media_id]); |
|
| 50 | 50 | |
| 51 | 51 | // promote the tweet using our line item |
| 52 | 52 | $promotedTweet = new PromotedTweet($account); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // create request for a nullcasted tweet with a website card |
| 58 | 58 | $websiteCard = new WebsiteCard($account); |
| 59 | 59 | $websiteCard = $websiteCard->all()->next(); |
| 60 | -$status = 'Tweet number 2 ...' . rand() . $websiteCard->getPreviewUrl(); |
|
| 60 | +$status = 'Tweet number 2 ...'.rand().$websiteCard->getPreviewUrl(); |
|
| 61 | 61 | |
| 62 | 62 | $tweet2 = Tweet::create($account, $status); |
| 63 | 63 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | /** Create a video entity and save it*/ |
| 32 | 32 | $video = new Video($account); |
| 33 | -$video->setTitle("Test Video " . rand()); |
|
| 34 | -$video->setDescription("Description" . rand()); |
|
| 33 | +$video->setTitle("Test Video ".rand()); |
|
| 34 | +$video->setDescription("Description".rand()); |
|
| 35 | 35 | $video->setVideoMediaId($media->media_id); |
| 36 | 36 | $video->save(); |
@@ -81,22 +81,22 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | /** Here you can add any header you want to the request*/ |
| 83 | 83 | $headers = [ |
| 84 | - 'x-ton-expires: ' . gmdate('D, d M Y H:i:s T', strtotime("+10 day")), |
|
| 85 | - 'content-type: ' . $this->getContentType(), |
|
| 86 | - 'Content-Length: ' . $this->fileSize |
|
| 84 | + 'x-ton-expires: '.gmdate('D, d M Y H:i:s T', strtotime("+10 day")), |
|
| 85 | + 'content-type: '.$this->getContentType(), |
|
| 86 | + 'Content-Length: '.$this->fileSize |
|
| 87 | 87 | ]; |
| 88 | 88 | |
| 89 | - $response = $this->getTwitterAds()->post(self::DEFAULT_DOMAIN . self::DEFAULT_RESOURCE . self::DEFAULT_BUCKET, ['raw' => file_get_contents($this->filePath)], $headers); |
|
| 89 | + $response = $this->getTwitterAds()->post(self::DEFAULT_DOMAIN.self::DEFAULT_RESOURCE.self::DEFAULT_BUCKET, ['raw' => file_get_contents($this->filePath)], $headers); |
|
| 90 | 90 | return $response; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function uploadChunk($resource, $chunkSize, $bytes, $bytesStart, $bytesRead) |
| 94 | 94 | { |
| 95 | 95 | $headers = [ |
| 96 | - 'Content-Type: ' . $this->getContentType(), |
|
| 97 | - 'Content-Range: bytes ' . $bytesStart . '-' . ($bytesRead - 1) . '/' . $this->fileSize |
|
| 96 | + 'Content-Type: '.$this->getContentType(), |
|
| 97 | + 'Content-Range: bytes '.$bytesStart.'-'.($bytesRead - 1).'/'.$this->fileSize |
|
| 98 | 98 | ]; |
| 99 | - $response = $this->getTwitterAds()->put(self::DEFAULT_DOMAIN . $resource, ['raw' => $bytes], $headers); |
|
| 99 | + $response = $this->getTwitterAds()->put(self::DEFAULT_DOMAIN.$resource, ['raw' => $bytes], $headers); |
|
| 100 | 100 | |
| 101 | 101 | return $response; |
| 102 | 102 | } |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | public function initChunkedUpload() |
| 105 | 105 | { |
| 106 | 106 | $headers = [ |
| 107 | - 'X-Ton-Content-Type: ' . $this->getContentType(), |
|
| 108 | - 'X-Ton-Content-Length: ' . $this->fileSize, |
|
| 109 | - 'X-Ton-Expires: ' . gmdate('D, d M Y H:i:s T', strtotime("+6 day")), |
|
| 110 | - 'Content-Type: ' . $this->getContentType(), |
|
| 111 | - 'Content-Length: ' . strval(0) |
|
| 107 | + 'X-Ton-Content-Type: '.$this->getContentType(), |
|
| 108 | + 'X-Ton-Content-Length: '.$this->fileSize, |
|
| 109 | + 'X-Ton-Expires: '.gmdate('D, d M Y H:i:s T', strtotime("+6 day")), |
|
| 110 | + 'Content-Type: '.$this->getContentType(), |
|
| 111 | + 'Content-Length: '.strval(0) |
|
| 112 | 112 | ]; |
| 113 | 113 | |
| 114 | - $resource = self::DEFAULT_DOMAIN . self::DEFAULT_RESOURCE . self::DEFAULT_BUCKET . '?resumable=true'; |
|
| 114 | + $resource = self::DEFAULT_DOMAIN.self::DEFAULT_RESOURCE.self::DEFAULT_BUCKET.'?resumable=true'; |
|
| 115 | 115 | $response = $this->getTwitterAds()->post($resource, [], $headers); |
| 116 | 116 | return $response; |
| 117 | 117 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $output = ''; |
| 18 | 18 | if (is_array($input)) { |
| 19 | - $output = array_map([__NAMESPACE__ . '\Util', 'urlencodeRfc3986'], $input); |
|
| 19 | + $output = array_map([__NAMESPACE__.'\Util', 'urlencodeRfc3986'], $input); |
|
| 20 | 20 | } elseif (is_scalar($input)) { |
| 21 | 21 | $output = rawurlencode($input); |
| 22 | 22 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | // June 12th, 2010 - changed to sort because of issue 164 by hidetaka |
| 105 | 105 | sort($value, SORT_STRING); |
| 106 | 106 | foreach ($value as $duplicateValue) { |
| 107 | - $pairs[] = $parameter . '=' . $duplicateValue; |
|
| 107 | + $pairs[] = $parameter.'='.$duplicateValue; |
|
| 108 | 108 | } |
| 109 | 109 | } else { |
| 110 | - $pairs[] = $parameter . '=' . $value; |
|
| 110 | + $pairs[] = $parameter.'='.$value; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61) |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function setTimeouts($connectionTimeout, $timeout) |
| 36 | 36 | { |
| 37 | - $this->connectionTimeout = (int)$connectionTimeout; |
|
| 38 | - $this->timeout = (int)$timeout; |
|
| 37 | + $this->connectionTimeout = (int) $connectionTimeout; |
|
| 38 | + $this->timeout = (int) $timeout; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function setDecodeJsonAsArray($value) |
| 45 | 45 | { |
| 46 | - $this->decodeJsonAsArray = (bool)$value; |
|
| 46 | + $this->decodeJsonAsArray = (bool) $value; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function setUserAgent($userAgent) |
| 53 | 53 | { |
| 54 | - $this->userAgent = (string)$userAgent; |
|
| 54 | + $this->userAgent = (string) $userAgent; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | $endTime = isset($params[AnalyticsFields::END_TIME]) ? $params[AnalyticsFields::END_TIME] : new \DateTime('now'); |
| 39 | 39 | $endTime->setTime($endTime->format('H'), 0, 0); |
| 40 | - $startTime = isset($params[AnalyticsFields::START_TIME]) ? $params[AnalyticsFields::START_TIME] : new \DateTime($endTime->format('c') . " - 7 days"); |
|
| 40 | + $startTime = isset($params[AnalyticsFields::START_TIME]) ? $params[AnalyticsFields::START_TIME] : new \DateTime($endTime->format('c')." - 7 days"); |
|
| 41 | 41 | $startTime->setTime($startTime->format('H'), 0, 0); |
| 42 | 42 | $granularity = isset($params[AnalyticsFields::GRANULARITY]) ? $params[AnalyticsFields::GRANULARITY] : Enumerations::GRANULARITY_TOTAL; |
| 43 | 43 | $placement = isset($params[AnalyticsFields::PLACEMENT]) ? $params[AnalyticsFields::PLACEMENT] : Enumerations::PLACEMENT_ALL_ON_TWITTER; |