Completed
Push — master ( 7dbde1...631665 )
by Camilo
11s
created
src/HttpClientRequestHandlerAmp.php 2 patches
Spacing   +3 added lines, -3 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 function reactAdapt(Promise $promise) {
20 20
     $deferred = new \React\Promise\Deferred();
21 21
 
22
-    $promise->onResolve(function ($error = null, $result = null) use ($deferred) {
22
+    $promise->onResolve(function($error = null, $result = null) use ($deferred) {
23 23
         if ($error) {
24 24
             $deferred->reject($error);
25 25
         } else {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @return PromiseInterface
77 77
      */
78 78
     private function processRequest(Request $request) {
79
-        return reactAdapt(\Amp\call(function () use ($request) {
79
+        return reactAdapt(\Amp\call(function() use ($request) {
80 80
             /** @var Response $response */
81 81
             $response = yield $this->client->request($request);
82 82
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,11 +61,13 @@  discard block
 block discarded – undo
61 61
     public function post(string $uri, array $formFields): PromiseInterface {
62 62
         $request = (new Request($uri))->withMethod('POST');
63 63
 
64
-        if (!empty($formFields['headers']))
65
-            $request = $request->withHeaders($formFields['headers']);
64
+        if (!empty($formFields['headers'])) {
65
+                    $request = $request->withHeaders($formFields['headers']);
66
+        }
66 67
 
67
-        if (!empty($formFields['body']))
68
-            $request = $request->withBody($formFields['body']);
68
+        if (!empty($formFields['body'])) {
69
+                    $request = $request->withBody($formFields['body']);
70
+        }
69 71
 
70 72
         return $this->processRequest($request);
71 73
     }
@@ -80,8 +82,9 @@  discard block
 block discarded – undo
80 82
             /** @var Response $response */
81 83
             $response = yield $this->client->request($request);
82 84
 
83
-            if ($response->getStatus() >= 400)
84
-                throw new ClientException($response->getReason(), $response->getStatus());
85
+            if ($response->getStatus() >= 400) {
86
+                            throw new ClientException($response->getReason(), $response->getStatus());
87
+            }
85 88
 
86 89
             return new TelegramResponse(yield $response->getBody(), $response->getHeaders());
87 90
         }));
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
 
@@ -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,9 +87,9 @@  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
-            }, function ($error) {
92
+            }, function($error) {
93 93
                 $this->logger->error($error);
94 94
             });
95 95
     }
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function downloadFile(File $file): PromiseInterface
103 103
     {
104
-        $url = 'https://api.telegram.org/file/bot' . $this->botToken . '/' . $file->file_path;
104
+        $url = 'https://api.telegram.org/file/bot'.$this->botToken.'/'.$file->file_path;
105 105
         $this->logger->debug('About to perform request to begin downloading file');
106 106
 
107 107
         return $this->requestHandler->get($url)->then(
108
-            function (TelegramResponse $rawData) {
108
+            function(TelegramResponse $rawData) {
109 109
                 return new TelegramDocument($rawData);
110 110
             }
111 111
         );
@@ -151,6 +151,6 @@  discard block
 block discarded – undo
151 151
         $this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
152 152
         $this->logger->info('About to perform API request', ['method' => $this->methodName]);
153 153
 
154
-        return $this->apiUrl . $this->methodName;
154
+        return $this->apiUrl.$this->methodName;
155 155
     }
156 156
 }
Please login to merge, or discard this patch.