Code Duplication    Length = 16-16 lines in 2 locations

src/Entities/InlineKeyboard.php 1 location

@@ 34-49 (lines=16) @@
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function validate()
35
    {
36
        $inline_keyboard = $this->getProperty('inline_keyboard');
37
38
        if ($inline_keyboard !== null) {
39
            if (!is_array($inline_keyboard)) {
40
                throw new TelegramException('Inline Keyboard field is not an array!');
41
            }
42
43
            foreach ($inline_keyboard as $item) {
44
                if (!is_array($item)) {
45
                    throw new TelegramException('Inline Keyboard subfield is not an array!');
46
                }
47
            }
48
        }
49
    }
50
}
51

src/Entities/Keyboard.php 1 location

@@ 179-194 (lines=16) @@
176
    /**
177
     * {@inheritdoc}
178
     */
179
    protected function validate()
180
    {
181
        $keyboard = $this->getProperty('keyboard');
182
183
        if ($keyboard !== null) {
184
            if (!is_array($keyboard)) {
185
                throw new TelegramException('Keyboard field is not an array!');
186
            }
187
188
            foreach ($keyboard as $item) {
189
                if (!is_array($item)) {
190
                    throw new TelegramException('Keyboard subfield is not an array!');
191
                }
192
            }
193
        }
194
    }
195
196
    /**
197
     * Hide the current custom keyboard and display the default letter-keyboard.