Code Duplication    Length = 12-12 lines in 6 locations

src/Request.php 6 locations

@@ 367-378 (lines=12) @@
364
     *
365
     * @return mixed
366
     */
367
    public static function sendPhoto(array $data, $file = null)
368
    {
369
        if (empty($data)) {
370
            throw new TelegramException('Data is empty!');
371
        }
372
373
        if (!is_null($file)) {
374
            $data['photo'] = self::encodeFile($file);
375
        }
376
377
        return self::send('sendPhoto', $data);
378
    }
379
380
    /**
381
     * Send audio
@@ 388-399 (lines=12) @@
385
     *
386
     * @return mixed
387
     */
388
    public static function sendAudio(array $data, $file = null)
389
    {
390
        if (empty($data)) {
391
            throw new TelegramException('Data is empty!');
392
        }
393
394
        if (!is_null($file)) {
395
            $data['audio'] = self::encodeFile($file);
396
        }
397
398
        return self::send('sendAudio', $data);
399
    }
400
401
    /**
402
     * Send document
@@ 409-420 (lines=12) @@
406
     *
407
     * @return mixed
408
     */
409
    public static function sendDocument(array $data, $file = null)
410
    {
411
        if (empty($data)) {
412
            throw new TelegramException('Data is empty!');
413
        }
414
415
        if (!is_null($file)) {
416
            $data['document'] = self::encodeFile($file);
417
        }
418
419
        return self::send('sendDocument', $data);
420
    }
421
422
    /**
423
     * Send sticker
@@ 430-441 (lines=12) @@
427
     *
428
     * @return mixed
429
     */
430
    public static function sendSticker(array $data, $file = null)
431
    {
432
        if (empty($data)) {
433
            throw new TelegramException('Data is empty!');
434
        }
435
436
        if (!is_null($file)) {
437
            $data['sticker'] = self::encodeFile($file);
438
        }
439
440
        return self::send('sendSticker', $data);
441
    }
442
443
    /**
444
     * Send video
@@ 451-462 (lines=12) @@
448
     *
449
     * @return mixed
450
     */
451
    public static function sendVideo(array $data, $file = null)
452
    {
453
        if (empty($data)) {
454
            throw new TelegramException('Data is empty!');
455
        }
456
457
        if (!is_null($file)) {
458
            $data['video'] = self::encodeFile($file);
459
        }
460
461
        return self::send('sendVideo', $data);
462
    }
463
464
    /**
465
     * Send voice
@@ 472-483 (lines=12) @@
469
     *
470
     * @return mixed
471
     */
472
    public static function sendVoice(array $data, $file = null)
473
    {
474
        if (empty($data)) {
475
            throw new TelegramException('Data is empty!');
476
        }
477
478
        if (!is_null($file)) {
479
            $data['voice'] = self::encodeFile($file);
480
        }
481
482
        return self::send('sendVoice', $data);
483
    }
484
485
    /**
486
     * Send location