Completed
Push — master ( 0cb834...ce1742 )
by Camilo
04:29
created

AnswerInlineQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 48
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindToObjectType() 0 4 1
A performSpecialConditions() 0 6 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\Telegram\Methods;
6
7
use unreal4u\Abstracts\TelegramMethods;
8
9
/**
10
 * Use this method to send answers to an inline query. On success, True is returned.
11
 * No more than 50 results per query are allowed.
12
 *
13
 * @see https://core.telegram.org/bots/api#answerinlinequery
14
 */
15
class AnswerInlineQuery extends TelegramMethods
16
{
17
    /**
18
     * Unique identifier for the answered query
19
     * @var string
20
     */
21
    public $inline_query_id = '';
22
23
    /**
24
     * A JSON-serialized array (of InlineQueryResult) of results for the inline query
25
     * @var array
26
     */
27
    public $results = [];
28
29
    /**
30
     * Optional. The maximum amount of time in seconds that the result of the inline query may be cached on the server.
31
     * Defaults to 300.
32
     * @var int
33
     */
34
    public $cache_time = 300;
35
36
    /**
37
     * Optional. Pass True, if results may be cached on the server side only for the user that sent the query. By
38
     * default, results may be returned to any user who sends the same query
39
     * @var bool
40
     */
41
    public $is_personal = false;
42
43
    /**
44
     * Optional. Pass the offset that a client should send in the next query with the same text to receive more results.
45
     * Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t
46
     * exceed 64 bytes.
47
     * @var string
48
     */
49
    public $next_offset = '';
50
51 2
    public static function bindToObjectType(): string
52
    {
53 2
        return 'Custom\\ResultBoolean';
54
    }
55
56 1
    public function performSpecialConditions(): TelegramMethods
57
    {
58 1
        $this->results = json_encode($this->results);
59
60 1
        return parent::performSpecialConditions();
61
    }
62
}
63