Passed
Pull Request — master (#431)
by Alexander
02:12
created
src/BotApi.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         // Informational 1xx
50 50
         100 => 'Continue',
51 51
         101 => 'Switching Protocols',
52
-        102 => 'Processing',            // RFC2518
52
+        102 => 'Processing', // RFC2518
53 53
         // Success 2xx
54 54
         200 => 'OK',
55 55
         201 => 'Created',
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         204 => 'No Content',
59 59
         205 => 'Reset Content',
60 60
         206 => 'Partial Content',
61
-        207 => 'Multi-Status',          // RFC4918
62
-        208 => 'Already Reported',      // RFC5842
63
-        226 => 'IM Used',               // RFC3229
61
+        207 => 'Multi-Status', // RFC4918
62
+        208 => 'Already Reported', // RFC5842
63
+        226 => 'IM Used', // RFC3229
64 64
         // Redirection 3xx
65 65
         300 => 'Multiple Choices',
66 66
         301 => 'Moved Permanently',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         305 => 'Use Proxy',
71 71
         // 306 is deprecated but reserved
72 72
         307 => 'Temporary Redirect',
73
-        308 => 'Permanent Redirect',    // RFC7238
73
+        308 => 'Permanent Redirect', // RFC7238
74 74
         // Client Error 4xx
75 75
         400 => 'Bad Request',
76 76
         401 => 'Unauthorized',
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
         415 => 'Unsupported Media Type',
91 91
         416 => 'Range Not Satisfiable',
92 92
         417 => 'Expectation Failed',
93
-        422 => 'Unprocessable Entity',                                        // RFC4918
94
-        423 => 'Locked',                                                      // RFC4918
95
-        424 => 'Failed Dependency',                                           // RFC4918
96
-        425 => 'Reserved for WebDAV advanced collections expired proposal',   // RFC2817
97
-        426 => 'Upgrade Required',                                            // RFC2817
98
-        428 => 'Precondition Required',                                       // RFC6585
99
-        429 => 'Too Many Requests',                                           // RFC6585
100
-        431 => 'Request Header Fields Too Large',                             // RFC6585
93
+        422 => 'Unprocessable Entity', // RFC4918
94
+        423 => 'Locked', // RFC4918
95
+        424 => 'Failed Dependency', // RFC4918
96
+        425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
97
+        426 => 'Upgrade Required', // RFC2817
98
+        428 => 'Precondition Required', // RFC6585
99
+        429 => 'Too Many Requests', // RFC6585
100
+        431 => 'Request Header Fields Too Large', // RFC6585
101 101
         // Server Error 5xx
102 102
         500 => 'Internal Server Error',
103 103
         501 => 'Not Implemented',
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
         503 => 'Service Unavailable',
106 106
         504 => 'Gateway Timeout',
107 107
         505 => 'HTTP Version Not Supported',
108
-        506 => 'Variant Also Negotiates (Experimental)',                      // RFC2295
109
-        507 => 'Insufficient Storage',                                        // RFC4918
110
-        508 => 'Loop Detected',                                               // RFC5842
111
-        510 => 'Not Extended',                                                // RFC2774
112
-        511 => 'Network Authentication Required',                             // RFC6585
108
+        506 => 'Variant Also Negotiates (Experimental)', // RFC2295
109
+        507 => 'Insufficient Storage', // RFC4918
110
+        508 => 'Loop Detected', // RFC5842
111
+        510 => 'Not Extended', // RFC2774
112
+        511 => 'Network Authentication Required', // RFC6585
113 113
     ];
114 114
 
115 115
     /**
116 116
      * @var array
117 117
      */
118
-    private $proxySettings = [];
118
+    private $proxySettings = [ ];
119 119
 
120 120
     /**
121 121
      * Default http status code
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      *
155 155
      * @var array
156 156
      */
157
-    protected $customCurlOptions = [];
157
+    protected $customCurlOptions = [ ];
158 158
 
159 159
     /**
160 160
      * Bot token
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @var array
177 177
      */
178
-    protected $trackedEvents = [];
178
+    protected $trackedEvents = [ ];
179 179
 
180 180
     /**
181 181
      * Check whether return associative array
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     public function call($method, array $data = null, $timeout = 10)
232 232
     {
233 233
         $options = $this->proxySettings + [
234
-            CURLOPT_URL => $this->getUrl().'/'.$method,
234
+            CURLOPT_URL => $this->getUrl() . '/' . $method,
235 235
             CURLOPT_RETURNTRANSFER => true,
236 236
             CURLOPT_POST => null,
237 237
             CURLOPT_POSTFIELDS => null,
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
         ];
240 240
 
241 241
         if ($data) {
242
-            $options[CURLOPT_POST] = true;
243
-            $options[CURLOPT_POSTFIELDS] = $data;
242
+            $options[ CURLOPT_POST ] = true;
243
+            $options[ CURLOPT_POSTFIELDS ] = $data;
244 244
         }
245 245
 
246 246
         if (!empty($this->customCurlOptions)) {
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
         $response = self::jsonValidate($this->executeCurl($options), $this->returnArray);
251 251
 
252 252
         if (\is_array($response)) {
253
-            if (!isset($response['ok']) || !$response['ok']) {
254
-                throw new Exception($response['description'], $response['error_code']);
253
+            if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) {
254
+                throw new Exception($response[ 'description' ], $response[ 'error_code' ]);
255 255
             }
256 256
 
257
-            return $response['result'];
257
+            return $response[ 'result' ];
258 258
         }
259 259
 
260 260
         if (!$response->ok) {
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
     public static function curlValidate($curl, $response = null)
301 301
     {
302 302
         if ($response) {
303
-            $json = json_decode($response, true) ?: [];
303
+            $json = json_decode($response, true) ?: [ ];
304 304
         } else {
305
-            $json = [];
305
+            $json = [ ];
306 306
         }
307 307
         if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE))
308
-            && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE])
308
+            && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ])
309 309
         ) {
310
-            $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode];
311
-            $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : [];
310
+            $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ];
311
+            $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ];
312 312
             throw new HttpException($errorDescription, $httpCode, null, $errorParameters);
313 313
         }
314 314
     }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
      */
576 576
     public function deleteWebhook($dropPendingUpdates = false)
577 577
     {
578
-        return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]);
578
+        return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]);
579 579
     }
580 580
 
581 581
     /**
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
      *
863 863
      * @author bernard-ng <[email protected]>
864 864
      */
865
-    public function getCustomEmojiStickers($customEmojiIds = [])
865
+    public function getCustomEmojiStickers($customEmojiIds = [ ])
866 866
     {
867 867
         return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [
868 868
             'custom_emoji_ids' => $customEmojiIds,
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
      */
1385 1385
     public function getFile($fileId)
1386 1386
     {
1387
-        return File::fromResponse($this->call('getFile', ['file_id' => $fileId]));
1387
+        return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ]));
1388 1388
     }
1389 1389
 
1390 1390
     /**
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
             CURLOPT_HEADER => 0,
1405 1405
             CURLOPT_HTTPGET => 1,
1406 1406
             CURLOPT_RETURNTRANSFER => 1,
1407
-            CURLOPT_URL => $this->getFileUrl().'/'.$file->getFilePath(),
1407
+            CURLOPT_URL => $this->getFileUrl() . '/' . $file->getFilePath(),
1408 1408
         ];
1409 1409
 
1410 1410
         return $this->executeCurl($options);
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
              * @param AbstractInlineQueryResult $item
1440 1440
              * @return array
1441 1441
              */
1442
-            function ($item) {
1442
+            function($item) {
1443 1443
                 /** @var array $array */
1444 1444
                 $array = $item->toJson(true);
1445 1445
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
      */
1754 1754
     public function getUrl()
1755 1755
     {
1756
-        return self::URL_PREFIX.$this->token;
1756
+        return self::URL_PREFIX . $this->token;
1757 1757
     }
1758 1758
 
1759 1759
     /**
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
      */
1762 1762
     public function getFileUrl()
1763 1763
     {
1764
-        return self::FILE_URL_PREFIX.$this->token;
1764
+        return self::FILE_URL_PREFIX . $this->token;
1765 1765
     }
1766 1766
 
1767 1767
     /**
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
             if (!$message) {
1780 1780
                 return;
1781 1781
             }
1782
-            $this->trackedEvents[] = $update->getUpdateId();
1782
+            $this->trackedEvents[ ] = $update->getUpdateId();
1783 1783
 
1784 1784
             $this->track($message, $eventName);
1785 1785
 
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
      * @return bool
1911 1911
      * @throws Exception
1912 1912
      */
1913
-    public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null)
1913
+    public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null)
1914 1914
     {
1915 1915
         return $this->call('answerShippingQuery', [
1916 1916
             'shipping_query_id' => $shippingQueryId,
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
     public function setProxy($proxyString = '', $socks5 = false)
2351 2351
     {
2352 2352
         if (empty($proxyString)) {
2353
-            $this->proxySettings = [];
2353
+            $this->proxySettings = [ ];
2354 2354
             return $this;
2355 2355
         }
2356 2356
 
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
         ];
2361 2361
 
2362 2362
         if ($socks5) {
2363
-            $this->proxySettings[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5;
2363
+            $this->proxySettings[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5;
2364 2364
         }
2365 2365
         return $this;
2366 2366
     }
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
      */
2687 2687
     public function setCurlOption($option, $value)
2688 2688
     {
2689
-        $this->customCurlOptions[$option] = $value;
2689
+        $this->customCurlOptions[ $option ] = $value;
2690 2690
     }
2691 2691
 
2692 2692
     /**
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
      */
2699 2699
     public function unsetCurlOption($option)
2700 2700
     {
2701
-        unset($this->customCurlOptions[$option]);
2701
+        unset($this->customCurlOptions[ $option ]);
2702 2702
     }
2703 2703
 
2704 2704
     /**
@@ -2708,6 +2708,6 @@  discard block
 block discarded – undo
2708 2708
      */
2709 2709
     public function resetCurlOptions()
2710 2710
     {
2711
-        $this->customCurlOptions = [];
2711
+        $this->customCurlOptions = [ ];
2712 2712
     }
2713 2713
 }
Please login to merge, or discard this patch.
src/HttpException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @var array
15 15
      */
16
-    protected $parameters = [];
16
+    protected $parameters = [ ];
17 17
 
18 18
     /**
19 19
      * HttpException constructor.
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param Exception $previous [optional] The previous throwable used for the exception chaining.
24 24
      * @param array $parameters [optional] Array of parameters returned from API.
25 25
      */
26
-    public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = [])
26
+    public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = [ ])
27 27
     {
28 28
         $this->parameters = $parameters;
29 29
 
Please login to merge, or discard this patch.