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

ShippingOption   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 42
c 0
b 0
f 0
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
A addPrice() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Type;
6
7
/**
8
 * Class ShippingOption.
9
 *
10
 * @see https://core.telegram.org/bots/api#shippingoption
11
 */
12
class ShippingOption
13
{
14
    /**
15
     * Shipping option identifier.
16
     *
17
     * @var string
18
     */
19
    public $id;
20
21
    /**
22
     * Option title.
23
     *
24
     * @var string
25
     */
26
    public $title;
27
28
    /**
29
     * List of price portions.
30
     *
31
     * @var LabeledPriceType[]
32
     */
33
    public $prices;
34
35
    /**
36
     * @param string $id
37
     * @param string $title
38
     * @param array  $prices
39
     */
40
    public static function create(string $id, string $title, array $prices)
41
    {
42
        $instance = new self();
43
        $instance->id = $id;
44
        $instance->title = $title;
45
        $instance->prices = $prices;
46
    }
47
48
    /**
49
     * @param LabeledPriceType $price
50
     */
51
    public function addPrice(LabeledPriceType $price)
52
    {
53
        $this->prices[] = $price;
54
    }
55
}
56