Completed
Pull Request — master (#55)
by Rick
03:55 queued 01:59
created
src/InternalFunctionality/TelegramDocument.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     /**
33 33
      * Constructs a representable document
34 34
      *
35
-     * @param Response $response
35
+     * @param TelegramResponse $response
36 36
      */
37 37
     public function __construct(TelegramResponse $response)
38 38
     {
Please login to merge, or discard this patch.
src/InternalFunctionality/TelegramResponse.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function getResult(): array
102 102
     {
103
-        return array_key_exists('result', $this->decodedData) ? (array) $this->decodedData['result'] : [];
103
+        return array_key_exists('result', $this->decodedData) ? (array)$this->decodedData['result'] : [];
104 104
     }
105 105
 
106 106
     /**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function getResultBoolean(): bool
112 112
     {
113
-        return array_key_exists('result', $this->decodedData) ? (bool) $this->decodedData['result'] : false;
113
+        return array_key_exists('result', $this->decodedData) ? (bool)$this->decodedData['result'] : false;
114 114
     }
115 115
 
116 116
     /**
Please login to merge, or discard this patch.
src/TgLog.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace unreal4u\TelegramAPI;
6 6
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         $this->requestHandler = $handler;
74 74
         $this->formConstructor = new PostOptionsConstructor();
75
-        $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/';
75
+        $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/';
76 76
     }
77 77
 
78 78
     /**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->resetObjectValues();
87 87
         $option = $this->formConstructor->constructOptions($method);
88 88
         return $this->sendRequestToTelegram($method, $option)
89
-            ->then(function (TelegramResponse $response) use ($method) {
89
+            ->then(function(TelegramResponse $response) use ($method) {
90 90
                 return $method::bindToObject($response, $this->logger);
91 91
             });
92 92
     }
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
     public function downloadFile(File $file): PromiseInterface
100 100
     {
101 101
         $this->logger->debug('Downloading file async from Telegram, creating URL');
102
-        $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
102
+        $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
103 103
         $this->logger->debug('About to perform request to begin downloading file');
104 104
 
105 105
         $deferred = new Deferred();
106 106
 
107 107
         return $this->requestHandler->get($url)->then(
108
-            function (TelegramResponse $rawData) use ($deferred) {
108
+            function(TelegramResponse $rawData) use ($deferred) {
109 109
                 $deferred->resolve(new TelegramDocument($rawData));
110 110
             },
111
-            function (\Exception $exception) use ($deferred) {
111
+            function(\Exception $exception) use ($deferred) {
112 112
                 $deferred->reject($exception);
113 113
             }
114 114
         );
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
         $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
155 155
         $this->logger->info('About to perform API request', ['method' => $this->methodName]);
156 156
 
157
-        return $this->apiUrl . $this->methodName;
157
+        return $this->apiUrl.$this->methodName;
158 158
     }
159 159
 }
Please login to merge, or discard this patch.
src/HttpClientRequestHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace unreal4u\TelegramAPI;
6 6
 
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
         $deferred = new Deferred();
61 61
 
62 62
         $receivedData = '';
63
-        $request->on('response', function (Response $response) use ($deferred, &$receivedData) {
64
-            $response->on('data', function ($chunk) use (&$receivedData) {
63
+        $request->on('response', function(Response $response) use ($deferred, &$receivedData) {
64
+            $response->on('data', function($chunk) use (&$receivedData) {
65 65
                 $receivedData .= $chunk;
66 66
             });
67 67
 
68
-            $response->on('end', function () use (&$receivedData, $deferred, $response) {
68
+            $response->on('end', function() use (&$receivedData, $deferred, $response) {
69 69
                 $deferred->resolve(new TelegramResponse($receivedData, $response->getHeaders()));
70 70
             });
71 71
         });
72 72
 
73
-        $request->on('error', function (\Exception $exception) use ($deferred, $receivedData) {
73
+        $request->on('error', function(\Exception $exception) use ($deferred, $receivedData) {
74 74
             // First check if the data we received thus far actually is valid.
75 75
             // Else, wipe it.
76 76
             if (!json_decode($receivedData)) {
Please login to merge, or discard this patch.