GetGameHighScoresMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 60
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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