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

AnswerInlineQuery::performSpecialConditions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 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