Completed
Pull Request — master (#61)
by Rick
02:29
created
src/TgLog.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         $this->requestHandler = $handler;
72 72
         $this->formConstructor = new PostOptionsConstructor();
73
-        $this->apiUrl = 'https://api.telegram.org/bot' . $this->botToken . '/';
73
+        $this->apiUrl = 'https://api.telegram.org/bot'.$this->botToken.'/';
74 74
     }
75 75
 
76 76
     /**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $this->resetObjectValues();
88 88
         $option = $this->formConstructor->constructOptions($method);
89 89
         return $this->sendRequestToTelegram($method, $option)
90
-            ->then(function (TelegramResponse $response) use ($method) {
90
+            ->then(function(TelegramResponse $response) use ($method) {
91 91
                 return $method::bindToObject($response, $this->logger);
92 92
             });
93 93
     }
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function downloadFile(File $file): PromiseInterface
101 101
     {
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
         return $this->requestHandler->get($url)->then(
106
-            function (TelegramResponse $rawData) {
106
+            function(TelegramResponse $rawData) {
107 107
                 return new TelegramDocument($rawData);
108 108
             }
109 109
         );
@@ -149,6 +149,6 @@  discard block
 block discarded – undo
149 149
         $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
150 150
         $this->logger->info('About to perform API request', ['method' => $this->methodName]);
151 151
 
152
-        return $this->apiUrl . $this->methodName;
152
+        return $this->apiUrl.$this->methodName;
153 153
     }
154 154
 }
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
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
         $deferred = new Deferred();
62 62
 
63 63
         $receivedData = '';
64
-        $request->on('response', function (Response $response) use ($deferred, &$receivedData) {
65
-            $response->on('data', function ($chunk) use (&$receivedData) {
64
+        $request->on('response', function(Response $response) use ($deferred, &$receivedData) {
65
+            $response->on('data', function($chunk) use (&$receivedData) {
66 66
                 $receivedData .= $chunk;
67 67
             });
68 68
 
69
-            $response->on('end', function () use (&$receivedData, $deferred, $response) {
69
+            $response->on('end', function() use (&$receivedData, $deferred, $response) {
70 70
                 try {
71 71
                     $endResponse = new TelegramResponse($receivedData, $response->getHeaders());
72 72
                     $deferred->resolve($endResponse);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             });
78 78
         });
79 79
 
80
-        $request->on('error', function (\Exception $e) use ($deferred) {
80
+        $request->on('error', function(\Exception $e) use ($deferred) {
81 81
             $deferred->reject(new ClientException($e->getMessage(), $e->getCode(), $e));
82 82
         });
83 83
 
Please login to merge, or discard this patch.
src/InternalFunctionality/PostOptionsConstructor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
         foreach ($data as $id => $value) {
116 116
             if ($id === $fileKeyName) {
117 117
                 $data = new MultipartData(
118
-                    (string) $id,
118
+                    (string)$id,
119 119
                     stream_get_contents($stream),
120 120
                     pathinfo($filename, PATHINFO_BASENAME)
121 121
                 );
122 122
             } else {
123
-                $data = new MultipartData((string) $id, (string) $value);
123
+                $data = new MultipartData((string)$id, (string)$value);
124 124
             }
125 125
             
126 126
             $builder->append($data);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $body = $builder->buildAll();
130 130
         $array = [
131 131
             'headers' => [
132
-                'Content-Type' => 'multipart/form-data; boundary="' . $builder->getBoundary() . '"',
132
+                'Content-Type' => 'multipart/form-data; boundary="'.$builder->getBoundary().'"',
133 133
                 'Content-Length' => strlen($body)
134 134
             ],
135 135
             'body' => $body
Please login to merge, or discard this patch.