Completed
Push — Helper ( 85a115...5a8248 )
by Nikolay
03:43
created

GetGameHighScoresMethod::createInline()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
/**
8
 * Class SetGameHighScoresMethod.
9
 *
10
 * Use this method to get data for high score tables.
11
 * Will return the score of the specified user and several of his neighbors in a game.
12
 * On success, returns an Array of GameHighScore objects.
13
 *
14
 * This method will currently return scores for the target user, plus two of his closest neighbors on each side.
15
 * Will also return the top three users if the user and his neighbors are not among them. P
16
 * lease note that this behavior is subject to change
17
 *
18
 * @see https://core.telegram.org/bots/api#getgamehighscores
19
 */
20
class GetGameHighScoresMethod
21
{
22
    /**
23
     * Target user id.
24
     *
25
     * @var int
26
     */
27
    public $userId;
28
29
    /**
30
     * Optional. Required if inline_message_id is not specified. Unique identifier for the target chat.
31
     *
32
     * @var int|null
33
     */
34
    public $chatId;
35
36
    /**
37
     * Optional. Required if inline_message_id is not specified. Identifier of the sent message.
38
     *
39
     * @var int|null
40
     */
41
    public $messageId;
42
43
    /**
44
     * Optional. Required if chat_id and message_id are not specified. Identifier of the inline message.
45
     *
46
     * @var string|null
47
     */
48
    public $inlineMessageId;
49
50
    /**
51
     * @param int $userId
52
     * @param int $chatId
53
     * @param int $messageId
54
     *
55
     * @return GetGameHighScoresMethod
56
     */
57 1
    public static function create(int $userId, int $chatId, int $messageId): GetGameHighScoresMethod
58
    {
59 1
        $instance = new static();
60 1
        $instance->userId = $userId;
61 1
        $instance->chatId = $chatId;
62 1
        $instance->messageId = $messageId;
63
64 1
        return $instance;
65
    }
66
67
    /**
68
     * @param int    $userId
69
     * @param string $inlineMessageId
70
     *
71
     * @return GetGameHighScoresMethod
72
     */
73 1
    public static function createInline(int $userId, string $inlineMessageId): GetGameHighScoresMethod
74
    {
75 1
        $instance = new static();
76 1
        $instance->userId = $userId;
77 1
        $instance->inlineMessageId = $inlineMessageId;
78
79 1
        return $instance;
80
    }
81
}
82