Code Duplication    Length = 12-12 lines in 11 locations

src/Client.php 11 locations

@@ 202-213 (lines=12) @@
199
        };
200
    }
201
202
    protected static function getMessageEvent(Closure $action)
203
    {
204
        return function (Update $update) use ($action) {
205
            if (!$update->getMessage()) {
206
                return true;
207
            }
208
209
            $reflectionAction = new ReflectionFunction($action);
210
            $reflectionAction->invokeArgs([$update->getMessage()]);
211
            return false;
212
        };
213
    }
214
215
    protected static function getEditedMessageEvent(Closure $action)
216
    {
@@ 215-226 (lines=12) @@
212
        };
213
    }
214
215
    protected static function getEditedMessageEvent(Closure $action)
216
    {
217
        return function (Update $update) use ($action) {
218
            if (!$update->getEditedMessage()) {
219
                return true;
220
            }
221
222
            $reflectionAction = new ReflectionFunction($action);
223
            $reflectionAction->invokeArgs([$update->getEditedMessage()]);
224
            return false;
225
        };
226
    }
227
228
    protected static function getChannelPostEvent(Closure $action)
229
    {
@@ 228-239 (lines=12) @@
225
        };
226
    }
227
228
    protected static function getChannelPostEvent(Closure $action)
229
    {
230
        return function (Update $update) use ($action) {
231
            if (!$update->getChannelPost()) {
232
                return true;
233
            }
234
235
            $reflectionAction = new ReflectionFunction($action);
236
            $reflectionAction->invokeArgs([$update->getChannelPost()]);
237
            return false;
238
        };
239
    }
240
241
    protected static function getCallbackQueryEvent(Closure $action)
242
    {
@@ 241-252 (lines=12) @@
238
        };
239
    }
240
241
    protected static function getCallbackQueryEvent(Closure $action)
242
    {
243
        return function (Update $update) use ($action) {
244
            if (!$update->getCallbackQuery()) {
245
                return true;
246
            }
247
248
            $reflectionAction = new ReflectionFunction($action);
249
            $reflectionAction->invokeArgs([$update->getCallbackQuery()]);
250
            return false;
251
        };
252
    }
253
254
    protected static function getEditedChannelPostEvent(Closure $action)
255
    {
@@ 254-265 (lines=12) @@
251
        };
252
    }
253
254
    protected static function getEditedChannelPostEvent(Closure $action)
255
    {
256
        return function (Update $update) use ($action) {
257
            if (!$update->getEditedChannelPost()) {
258
                return true;
259
            }
260
261
            $reflectionAction = new ReflectionFunction($action);
262
            $reflectionAction->invokeArgs([$update->getEditedChannelPost()]);
263
            return false;
264
        };
265
    }
266
267
    protected static function getInlineQueryEvent(Closure $action)
268
    {
@@ 267-278 (lines=12) @@
264
        };
265
    }
266
267
    protected static function getInlineQueryEvent(Closure $action)
268
    {
269
        return function (Update $update) use ($action) {
270
            if (!$update->getInlineQuery()) {
271
                return true;
272
            }
273
274
            $reflectionAction = new ReflectionFunction($action);
275
            $reflectionAction->invokeArgs([$update->getInlineQuery()]);
276
            return false;
277
        };
278
    }
279
280
    protected static function getChosenInlineResultEvent(Closure $action)
281
    {
@@ 280-291 (lines=12) @@
277
        };
278
    }
279
280
    protected static function getChosenInlineResultEvent(Closure $action)
281
    {
282
        return function (Update $update) use ($action) {
283
            if (!$update->getChosenInlineResult()) {
284
                return true;
285
            }
286
287
            $reflectionAction = new ReflectionFunction($action);
288
            $reflectionAction->invokeArgs([$update->getChosenInlineResult()]);
289
            return false;
290
        };
291
    }
292
293
    protected static function getShippingQueryEvent(Closure $action)
294
    {
@@ 293-304 (lines=12) @@
290
        };
291
    }
292
293
    protected static function getShippingQueryEvent(Closure $action)
294
    {
295
        return function (Update $update) use ($action) {
296
            if (!$update->getShippingQuery()) {
297
                return true;
298
            }
299
300
            $reflectionAction = new ReflectionFunction($action);
301
            $reflectionAction->invokeArgs([$update->getShippingQuery()]);
302
            return false;
303
        };
304
    }
305
306
    protected static function getPreCheckoutQueryEvent(Closure $action)
307
    {
@@ 306-317 (lines=12) @@
303
        };
304
    }
305
306
    protected static function getPreCheckoutQueryEvent(Closure $action)
307
    {
308
        return function (Update $update) use ($action) {
309
            if (!$update->getPreCheckoutQuery()) {
310
                return true;
311
            }
312
313
            $reflectionAction = new ReflectionFunction($action);
314
            $reflectionAction->invokeArgs([$update->getPreCheckoutQuery()]);
315
            return false;
316
        };
317
    }
318
319
    protected static function getPollEvent(Closure $action)
320
    {
@@ 319-330 (lines=12) @@
316
        };
317
    }
318
319
    protected static function getPollEvent(Closure $action)
320
    {
321
        return function (Update $update) use ($action) {
322
            if (!$update->getPoll()) {
323
                return true;
324
            }
325
326
            $reflectionAction = new ReflectionFunction($action);
327
            $reflectionAction->invokeArgs([$update->getPoll()]);
328
            return false;
329
        };
330
    }
331
332
    protected static function getPollAnswerEvent(Closure $action)
333
    {
@@ 332-343 (lines=12) @@
329
        };
330
    }
331
332
    protected static function getPollAnswerEvent(Closure $action)
333
    {
334
        return function (Update $update) use ($action) {
335
            if (!$update->getPollAnswer()) {
336
                return true;
337
            }
338
339
            $reflectionAction = new ReflectionFunction($action);
340
            $reflectionAction->invokeArgs([$update->getPollAnswer()]);
341
            return false;
342
        };
343
    }
344
345
    /**
346
     * Returns check function to handling the command.