Completed
Push — draft ( f5c2f2...2c1ae4 )
by Nikolay
02:24
created

LabeledPriceType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\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
    public static function create(string $label, int $amount)
39
    {
40
        $instance = new self();
41
        $instance->label = $label;
42
        $instance->amount = $amount;
43
    }
44
}
45