Completed
Push — master ( 23095d...54d687 )
by Danilo
02:12
created

CallbackQuery   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 2

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 6 2
A getChatID() 0 6 2
A getMessage() 0 11 2
A getBotParameter() 0 5 1
A getID() 0 5 1
1
<?php
2
3
namespace PhpBotFramework\Entities;
4
5
class CallbackQuery implements \ArrayAccess {
6
7
    use EntityAccess;
8
9
    public function getData() : string {
10
11
        // Get text of the message if any
12
        return isset($this->container['data']) ? $this->container['data'] : null;
13
14
    }
15
16
    public function getChatID() {
17
18
        // Return the chat id
19
        return isset($this->container['message']) ? $this->container['message']['chat']['id'] : null;
20
21
    }
22
23
    public function getMessage() {
24
25
        if (!is_a($this->container, 'PhpBotFramework\Entities\Message')) {
26
27
            $this->container['message'] = new Message($this->container['message']);
28
29
        }
30
31
        return $this->container['message'];
32
33
    }
34
35
    public function getBotParameter() : array {
36
37
        return ['var' => '_callback_query_id', 'id' => $this->container['id']];
38
39
    }
40
41
    public function getID() : int {
42
43
        return $this->container['id'];
44
45
    }
46
47
}
48