LabeledPriceType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 35
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type;
6
7
/**
8
 * Class LabeledPriceType.
9
 *
10
 * @see https://core.telegram.org/bots/api#labeledprice
11
 */
12
class LabeledPriceType
13
{
14
    /**
15
     * Portion label.
16
     *
17
     * @var string
18
     */
19
    public $label;
20
21
    /**
22
     * Price of the product in the smallest units of the currency (integer, not float/double).
23
     * For example, for a price of US$ 1.45 pass amount = 145.
24
     * See the exp parameter in currencies.json,
25
     * it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
26
     *
27
     * @see https://core.telegram.org/bots/payments#supported-currencies
28
     * @see https://core.telegram.org/bots/payments/currencies.json
29
     *
30
     * @var int
31
     */
32
    public $amount;
33
34
    /**
35
     * @param string $label
36
     * @param int    $amount
37
     *
38
     * @return LabeledPriceType
39
     */
40 2
    public static function create(string $label, int $amount): LabeledPriceType
41
    {
42 2
        $instance = new static();
43 2
        $instance->label = $label;
44 2
        $instance->amount = $amount;
45
46 2
        return $instance;
47
    }
48
}
49