Passed
Push — develop ( 412e3b...501afa )
by Septianata
08:29 queued 02:14
created
app/Conversations/RegisterCustomerConversation.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $this->displayValidationErrorMessage($validationErrorMessage);
36 36
 
37
-        return $this->askRenderable('conversations.exchange.ask-email', function (Answer $answer) {
37
+        return $this->askRenderable('conversations.exchange.ask-email', function(Answer $answer) {
38 38
             $value = $answer->getText();
39 39
             $validator = CustomerStoreRequest::createValidator($value, 'email');
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 return $this->askEmail($validator->errors()->first('email'));
43 43
             }
44 44
 
45
-            $this->setUserStorage(['email' => $email = $validator->validated()['email']]);
45
+            $this->setUserStorage([ 'email' => $email = $validator->validated()[ 'email' ] ]);
46 46
 
47 47
             $username = $this->getUser()->getUsername();
48 48
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $this->displayValidationErrorMessage($validationErrorMessage);
66 66
 
67
-        return $this->askRenderable('conversations.register-customer.ask-fullname', function (Answer $answer) {
67
+        return $this->askRenderable('conversations.register-customer.ask-fullname', function(Answer $answer) {
68 68
             $value = $answer->getText();
69 69
             $validator = CustomerStoreRequest::createValidator($value, 'fullname');
70 70
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $this->askFullName($validator->errors()->first('fullname'));
73 73
             }
74 74
 
75
-            $this->setUserStorage(['fullname' => $validator->validated()['fullname']]);
75
+            $this->setUserStorage([ 'fullname' => $validator->validated()[ 'fullname' ] ]);
76 76
 
77 77
             return $this->askIdentityNumberOption();
78 78
         });
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
                 Button::create(view('conversations.register-customer.reply-identity_number-no')->render())->value('no'),
102 102
             ]);
103 103
 
104
-        return $this->ask($question, function (Answer $answer) {
104
+        return $this->ask($question, function(Answer $answer) {
105 105
             if (!$answer->isInteractiveMessageReply()) {
106 106
                 return;
107 107
             }
108 108
 
109
-            if (!in_array($value = $answer->getValue(), ['yes', 'no'])) {
109
+            if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) {
110 110
                 return $this->askIdentityNumberOption($this->fallbackMessage($answer->getText()));
111 111
             }
112 112
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected function backToIdentityNumberOption(): string
125 125
     {
126
-        return trim(view('components.conversations.back', ['text' => 'opsi rekening/KTP'])->render());
126
+        return trim(view('components.conversations.back', [ 'text' => 'opsi rekening/KTP' ])->render());
127 127
     }
128 128
 
129 129
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $additionalParameters = $this->keyboardBackToIdentityNumberOption()->toArray()
154 154
         );
155 155
 
156
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) {
156
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) {
157 157
             if (trim($answer->getText()) === $this->backToIdentityNumberOption()) {
158 158
                 $this->deleteTelegramMessageFromResponse($response);
159 159
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 return $this->askAccountNumber($validator->errors()->first('account_number'));
168 168
             }
169 169
 
170
-            $this->setUserStorage(['account_number' => $validator->validated()['account_number']]);
170
+            $this->setUserStorage([ 'account_number' => $validator->validated()[ 'account_number' ] ]);
171 171
 
172 172
             return $this->askPhone();
173 173
         }, question: $question, additionalParameters: $additionalParameters);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $additionalParameters = $this->keyboardBackToIdentityNumberOption()->toArray()
189 189
         );
190 190
 
191
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) {
191
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) {
192 192
             if (trim($answer->getText()) === $this->backToIdentityNumberOption()) {
193 193
                 $this->deleteTelegramMessageFromResponse($response);
194 194
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 return $this->askIdentityCard($validator->errors()->first('identitycard_number'));
203 203
             }
204 204
 
205
-            $this->setUserStorage(['identitycard_number' => $validator->validated()['identitycard_number']]);
205
+            $this->setUserStorage([ 'identitycard_number' => $validator->validated()[ 'identitycard_number' ] ]);
206 206
 
207 207
             return $this->askPhone();
208 208
         }, question: $question, additionalParameters: $additionalParameters);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     {
219 219
         $this->displayValidationErrorMessage($validationErrorMessage);
220 220
 
221
-        return $this->askRenderable('conversations.register-customer.ask-phone', function () {
221
+        return $this->askRenderable('conversations.register-customer.ask-phone', function() {
222 222
             $value = $this->getMessagePayload('contact.phone_number');
223 223
             $validator = CustomerStoreRequest::createValidator($value, 'phone');
224 224
 
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
                 return $this->askPhone($validator->errors()->first('phone'));
227 227
             }
228 228
 
229
-            $this->setUserStorage(['phone' => $validator->validated()['phone']]);
229
+            $this->setUserStorage([ 'phone' => $validator->validated()[ 'phone' ] ]);
230 230
 
231 231
             return $this->askWhatsappPhone();
232
-        }, additionalParameters: ['reply_markup' => json_encode([
233
-            'keyboard' => [[['text' => '☎️ ' . trans('Send My Phone Number'), 'request_contact' => true]]],
232
+        }, additionalParameters: [ 'reply_markup' => json_encode([
233
+            'keyboard' => [ [ [ 'text' => '☎️ '.trans('Send My Phone Number'), 'request_contact' => true ] ] ],
234 234
             'resize_keyboard' => true,
235 235
             'one_time_keyboard' => true,
236 236
             'remove_keyboard' => true,
237
-        ])]);
237
+        ]) ]);
238 238
     }
239 239
 
240 240
     /**
@@ -247,34 +247,34 @@  discard block
 block discarded – undo
247 247
     {
248 248
         $this->displayValidationErrorMessage($validationErrorMessage);
249 249
 
250
-        $question = Question::create(view('conversations.register-customer.confirm-whatsapp_phone', ['phone' => $this->getUserStorage('phone')])->render())
250
+        $question = Question::create(view('conversations.register-customer.confirm-whatsapp_phone', [ 'phone' => $this->getUserStorage('phone') ])->render())
251 251
             ->callbackId('register_confirm_whatsapp_phone')
252 252
             ->addButtons([
253 253
                 Button::create(view('conversations.register-customer.reply-whatsapp_phone-yes')->render())->value('yes'),
254 254
                 Button::create(view('conversations.register-customer.reply-whatsapp_phone-no')->render())->value('no'),
255 255
             ]);
256 256
 
257
-        return $this->ask($question, function (Answer $answer) {
257
+        return $this->ask($question, function(Answer $answer) {
258 258
             if (!$answer->isInteractiveMessageReply()) {
259 259
                 return;
260 260
             }
261 261
 
262
-            if (!in_array($value = $answer->getValue(), ['yes', 'no'])) {
262
+            if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) {
263 263
                 return $this->askWhatsappPhone($this->fallbackMessage($answer->getText()));
264 264
             }
265 265
 
266 266
             $phone = $this->getUserStorage('phone');
267 267
 
268 268
             if ($value === 'yes') {
269
-                $this->setUserStorage(['whatsapp_phone' => $phone]);
269
+                $this->setUserStorage([ 'whatsapp_phone' => $phone ]);
270 270
 
271 271
                 return $this->askLocation();
272 272
             }
273 273
 
274
-            return value(function (string $validationErrorMessage = null) use (&$callback) {
274
+            return value(function(string $validationErrorMessage = null) use (&$callback) {
275 275
                 $this->displayValidationErrorMessage($validationErrorMessage);
276 276
 
277
-                $this->askRenderable('conversations.register-customer.ask-whatsapp_phone', function (Answer $answer) use (&$phone, $callback) {
277
+                $this->askRenderable('conversations.register-customer.ask-whatsapp_phone', function(Answer $answer) use (&$phone, $callback) {
278 278
                     $value = $answer->getText();
279 279
                     $validator = CustomerStoreRequest::createValidator($value, 'whatsapp_phone');
280 280
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
                         return $callback($validator->errors()->first('whatsapp_phone'));
283 283
                     }
284 284
 
285
-                    $phone = $validator->validated()['whatsapp_phone'];
285
+                    $phone = $validator->validated()[ 'whatsapp_phone' ];
286 286
 
287
-                    $this->setUserStorage(['whatsapp_phone' => $phone]);
287
+                    $this->setUserStorage([ 'whatsapp_phone' => $phone ]);
288 288
 
289 289
                     return $this->askLocation();
290 290
                 });
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $this->displayValidationErrorMessage($validationErrorMessage);
304 304
 
305
-        return $this->askRenderable('conversations.register-customer.ask-location', function () {
305
+        return $this->askRenderable('conversations.register-customer.ask-location', function() {
306 306
             $latitude = $this->getMessagePayload('location.latitude');
307 307
             $longitude = $this->getMessagePayload('location.longitude');
308 308
 
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
             ]);
324 324
 
325 325
             return $this->askDataConfirmation();
326
-        }, additionalParameters: ['reply_markup' => json_encode([
327
-            'keyboard' => [[['text' => '
Please login to merge, or discard this patch.