Passed
Push — master ( 72ea7a...b665cb )
by Shahrad
12:25
created

DummyUpdate::messageWithEntities()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 27
c 1
b 0
f 0
dl 0
loc 35
rs 9.488
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace TelegramBotTest;
4
5
use Faker\Factory;
6
use Faker\Generator;
7
use TelegramBot\Entities\Message;
8
9
class DummyUpdate {
10
11
12
   private static function faker(): Generator {
13
      return Factory::create();
14
   }
15
16
   public static function message(): Message {
17
      return new Message([
18
         'message_id' => self::faker()->randomNumber(),
19
         'from' => [
20
            'id' => self::faker()->randomNumber(),
21
            'is_bot' => false,
22
            'first_name' => self::faker()->firstName(),
23
            'last_name' => self::faker()->lastName(),
24
            'username' => self::faker()->userName(),
25
            'language_code' => self::faker()->languageCode(),
26
         ],
27
         'chat' => [
28
            'id' => self::faker()->randomNumber(),
29
            'first_name' => self::faker()->firstName(),
30
            'last_name' => self::faker()->lastName(),
31
            'username' => self::faker()->userName(),
32
            'type' => 'private',
33
         ],
34
         'date' => self::faker()->unixTime(),
35
         'text' => self::faker()->sentence(),
36
      ]);
37
   }
38
39
   public static function messageWithEntities(): Message {
40
      return new Message([
41
         'message_id' => self::faker()->randomNumber(),
42
         'from' => [
43
            'id' => self::faker()->randomNumber(),
44
            'is_bot' => false,
45
            'first_name' => self::faker()->firstName(),
46
            'last_name' => self::faker()->lastName(),
47
            'username' => self::faker()->userName(),
48
            'language_code' => self::faker()->languageCode(),
49
         ],
50
         'chat' => [
51
            'id' => self::faker()->randomNumber(),
52
            'first_name' => self::faker()->firstName(),
53
            'last_name' => self::faker()->lastName(),
54
            'username' => self::faker()->userName(),
55
            'type' => 'private',
56
         ],
57
         'date' => self::faker()->unixTime(),
58
         'text' => self::faker()->sentence(),
59
         'entities' => [
60
            [
61
               'offset' => 0,
62
               'length' => 1,
63
               'type' => 'bold',
64
            ],
65
            [
66
               'offset' => 2,
67
               'length' => 3,
68
               'type' => 'italic',
69
            ],
70
            [
71
               'offset' => 6,
72
               'length' => 7,
73
               'type' => 'code',
74
            ]
75
         ]
76
      ]);
77
   }
78
79
   public static function messageWithReply(): Message {
80
      return new Message([
81
         'message_id' => self::faker()->randomNumber(),
82
         'from' => [
83
            'id' => self::faker()->randomNumber(),
84
            'is_bot' => false,
85
            'first_name' => self::faker()->firstName(),
86
            'last_name' => self::faker()->lastName(),
87
            'username' => self::faker()->userName(),
88
            'language_code' => self::faker()->languageCode(),
89
         ],
90
         'chat' => [
91
            'id' => self::faker()->randomNumber(),
92
            'first_name' => self::faker()->firstName(),
93
            'last_name' => self::faker()->lastName(),
94
            'username' => self::faker()->userName(),
95
            'type' => 'private',
96
         ],
97
         'date' => self::faker()->unixTime(),
98
         'text' => self::faker()->sentence(),
99
         'reply_to_message' => [
100
            'message_id' => self::faker()->randomNumber(),
101
            'from' => [
102
               'id' => self::faker()->randomNumber(),
103
               'is_bot' => false,
104
               'first_name' => self::faker()->firstName(),
105
               'last_name' => self::faker()->lastName(),
106
               'username' => self::faker()->userName(),
107
               'language_code' => self::faker()->languageCode(),
108
            ],
109
            'chat' => [
110
               'id' => self::faker()->randomNumber(),
111
               'first_name' => self::faker()->firstName(),
112
               'last_name' => self::faker()->lastName(),
113
               'username' => self::faker()->userName(),
114
               'type' => 'private',
115
            ],
116
            'date' => self::faker()->unixTime(),
117
            'text' => self::faker()->sentence(),
118
         ]
119
      ]);
120
   }
121
122
}