Completed
Pull Request — master (#75)
by Hector
01:26
created
autoload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/TONUpload.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -90,6 +90,12 @@
 block discarded – undo
90 90
         return $response;
91 91
     }
92 92
 
93
+    /**
94
+     * @param integer $chunkSize
95
+     * @param string $bytes
96
+     * @param integer $bytesStart
97
+     * @param integer $bytesRead
98
+     */
93 99
     public function uploadChunk($resource, $chunkSize, $bytes, $bytesStart, $bytesRead)
94 100
     {
95 101
         $headers = [
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,22 +74,22 @@  discard block
 block discarded – undo
74 74
     {
75 75
         /** Here you can add any header you want to the request*/
76 76
         $headers = [
77
-            'x-ton-expires: ' . gmdate('D, d M Y H:i:s T', strtotime('+10 day')),
78
-            'content-type: ' . $this->getContentType(),
79
-            'Content-Length: ' . $this->fileSize
77
+            'x-ton-expires: '.gmdate('D, d M Y H:i:s T', strtotime('+10 day')),
78
+            'content-type: '.$this->getContentType(),
79
+            'Content-Length: '.$this->fileSize
80 80
         ];
81 81
 
82
-        $response = $this->getTwitterAds()->post(self::DEFAULT_DOMAIN . self::DEFAULT_RESOURCE . self::DEFAULT_BUCKET, ['raw' => file_get_contents($this->filePath)], $headers);
82
+        $response = $this->getTwitterAds()->post(self::DEFAULT_DOMAIN.self::DEFAULT_RESOURCE.self::DEFAULT_BUCKET, ['raw' => file_get_contents($this->filePath)], $headers);
83 83
         return $response;
84 84
     }
85 85
 
86 86
     public function uploadChunk($resource, $chunkSize, $bytes, $bytesStart, $bytesRead)
87 87
     {
88 88
         $headers = [
89
-            'Content-Type: ' . $this->getContentType(),
90
-            'Content-Range: bytes ' . $bytesStart . '-' . ($bytesRead - 1) . '/' . $this->fileSize
89
+            'Content-Type: '.$this->getContentType(),
90
+            'Content-Range: bytes '.$bytesStart.'-'.($bytesRead - 1).'/'.$this->fileSize
91 91
         ];
92
-        $response = $this->getTwitterAds()->put(self::DEFAULT_DOMAIN . $resource, ['raw' => $bytes], $headers);
92
+        $response = $this->getTwitterAds()->put(self::DEFAULT_DOMAIN.$resource, ['raw' => $bytes], $headers);
93 93
 
94 94
         return $response;
95 95
     }
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     public function initChunkedUpload()
98 98
     {
99 99
         $headers = [
100
-            'X-Ton-Content-Type: ' . $this->getContentType(),
101
-            'X-Ton-Content-Length: ' . $this->fileSize,
102
-            'X-Ton-Expires: ' . gmdate('D, d M Y H:i:s T', strtotime('+6 day')),
103
-            'Content-Type: ' . $this->getContentType(),
104
-            'Content-Length: ' . strval(0)
100
+            'X-Ton-Content-Type: '.$this->getContentType(),
101
+            'X-Ton-Content-Length: '.$this->fileSize,
102
+            'X-Ton-Expires: '.gmdate('D, d M Y H:i:s T', strtotime('+6 day')),
103
+            'Content-Type: '.$this->getContentType(),
104
+            'Content-Length: '.strval(0)
105 105
         ];
106 106
 
107
-        $resource = self::DEFAULT_DOMAIN . self::DEFAULT_RESOURCE . self::DEFAULT_BUCKET . '?resumable=true';
107
+        $resource = self::DEFAULT_DOMAIN.self::DEFAULT_RESOURCE.self::DEFAULT_BUCKET.'?resumable=true';
108 108
         return $this->getTwitterAds()->post($resource, [], $headers);
109 109
     }
110 110
 
Please login to merge, or discard this patch.
src/TwitterAds/Cursor.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@
 block discarded – undo
217 217
     /**
218 218
      * Return the key of the current element
219 219
      * @link http://php.net/manual/en/iterator.key.php
220
-     * @return mixed scalar on success, or null on failure.
220
+     * @return integer scalar on success, or null on failure.
221 221
      * @since 5.0.0
222 222
      */
223 223
     public function key()
Please login to merge, or discard this patch.
src/Util.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $postData = $this->toPostdata();
179 179
         $out = $this->getNormalizedHttpUrl();
180 180
         if ($postData) {
181
-            $out .= '?' . $postData;
181
+            $out .= '?'.$postData;
182 182
         }
183 183
 
184 184
         return $out;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 throw new TwitterOAuthException('Arrays not supported in headers');
214 214
             }
215 215
             $out .= ($first) ? ' ' : ', ';
216
-            $out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
216
+            $out .= Util::urlencodeRfc3986($k).'="'.Util::urlencodeRfc3986($v).'"';
217 217
             $first = false;
218 218
         }
219 219
 
@@ -257,6 +257,6 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public static function generateNonce()
259 259
     {
260
-        return md5(microtime() . mt_rand());
260
+        return md5(microtime().mt_rand());
261 261
     }
262 262
 }
Please login to merge, or discard this patch.
src/TwitterAds/Fields/ScheduledPromotedTweetFields.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
     const APPROVAL_STATUS = 'approval_status';
16 16
     const LINE_ITEM_ID    = 'line_item_id';
17 17
     const TWEET_ID        = 'tweet_id';
18
-    const SCHEDULED_TWEET_IDS       = 'scheduled_tweet_ids';
19
-    const SCHEDULED_TWEET_ID       = 'scheduled_tweet_id';
18
+    const SCHEDULED_TWEET_IDS = 'scheduled_tweet_ids';
19
+    const SCHEDULED_TWEET_ID = 'scheduled_tweet_id';
20 20
     const ENTITY_STATUS = 'entity_status';
21 21
     const PROMOTED_TWEET_IDS = 'promoted_tweet_ids';
22 22
     const LINE_ITEM_IDS = 'line_item_ids';
Please login to merge, or discard this patch.
src/TwitterAds/Resource.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     /**
29 29
      * Automatically set the account if this class is not an account
30 30
      * Resource constructor.
31
-     * @param null $id
31
+     * @param string $id
32 32
      * @param TwitterAds $twitterAds
33 33
      */
34 34
     public function __construct($id = null, TwitterAds $twitterAds = null)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $instance = $instance ?: TwitterAds::instance();
57 57
         if (!$instance) {
58 58
             throw new InvalidArgumentException(
59
-                'An Api instance must be provided as argument or ' .
59
+                'An Api instance must be provided as argument or '.
60 60
                 'set as instance in the \TwitterAds\Api'
61 61
             );
62 62
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 $params[$property] = implode(',', $this->$property);
200 200
             } elseif (is_bool($this->$property)) {
201 201
                 $params[$property] = $this->$property ? 'true' : 'false';
202
-            } elseif (isset($this->$property->id)){
202
+            } elseif (isset($this->$property->id)) {
203 203
                 $params[$property] = strval($this->$property->id);
204 204
             } else {
205 205
                 $params[$property] = strval($this->$property);
Please login to merge, or discard this patch.
examples/promoted_tweet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 // create request for a simple nullcasted tweet
59 59
 $media = $api->upload(['media' => 'kitten.jpg']);
60
-$tweet1 = Tweet::create($account, 'Tweet number 1 ...' . rand() . ' http://twitter.com', ['media_ids' => $media->media_id]);
60
+$tweet1 = Tweet::create($account, 'Tweet number 1 ...'.rand().' http://twitter.com', ['media_ids' => $media->media_id]);
61 61
 
62 62
 // promote the tweet using our line item
63 63
 $promotedTweet = new PromotedTweet();
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 // create request for a nullcasted tweet with a website card
69 69
 $websiteCard = new WebsiteCard();
70 70
 $websiteCard = $websiteCard->all()->getCollection()[0];
71
-$status = 'Tweet number 2 ...' . rand();
71
+$status = 'Tweet number 2 ...'.rand();
72 72
 
73 73
 $tweet2 = Tweet::create($account, $status, [TweetFields::CARD_URI => $websiteCard->getCardUri()]);
74 74
 
Please login to merge, or discard this patch.