Completed
Push — master ( e9be36...9488e8 )
by Camilo
04:57
created

Markup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 18
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapSubObjects() 0 9 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Types\Inline\Keyboard;
6
7
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8
use unreal4u\TelegramAPI\Telegram\Types\Custom\InlineKeyboardButtonArray;
9
10
/**
11
 * This object represents an inline keyboard that appears right next to the message it belongs to.
12
 *
13
 * Warning: Inline keyboards are currently being tested and are only available in one-on-one chats (i.e., user-bot or
14
 * user-user in the case of inline bots).
15
 *
16
 * Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported
17
 * message.
18
 *
19
 * Objects defined as-is july 2016
20
 *
21
 * @see https://core.telegram.org/bots/api#replykeyboardhide
22
 */
23
class Markup
24
{
25
    /**
26
     * Array of button rows, each represented by an Array of InlineKeyboardButton objects
27
     * @var array
28
     */
29
    public $inline_keyboard = [];
30
31
    protected function mapSubObjects(string $key, array $data): TelegramTypes
32
    {
33
        switch ($key) {
34
            case 'inline_keyboard':
35
                return new InlineKeyboardButtonArray($data, $this->logger);
0 ignored issues
show
Bug introduced by
The property logger does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
        }
37
38
        return parent::mapSubObjects($key, $data);
39
    }
40
}
41