Passed
Push — master ( 65a6b4...cbdbb3 )
by Jhao
02:03
created

CustomsDeclarationItem::getTnvedCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Orders\Entites;
6
7
use Appwilio\RussianPostSDK\Dispatching\DataAware;
8
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
9
10
final class CustomsDeclarationItem implements Arrayable
11
{
12
    use DataAware;
13
14
    public function __construct(
15
        string $description,
16
        int $quantity,
17
        string $country,
18
        string $tnvedCode,
19
        int $value = null,
20
        int $weight = null
21
    ) {
22
        $this->data['description'] = $description;
23
        $this->data['amount'] = $quantity;
24
        $this->data['country-code'] = $country;
25
        $this->data['tnved-code'] = $tnvedCode;
26
        $this->data['value'] = $value;
27
        $this->data['weight'] = $weight;
28
    }
29
30
    public function getDescription(): ?string
31
    {
32
        return $this->get('description');
33
    }
34
35
    public function getQuantity(): ?int
36
    {
37
        return $this->get('amount');
38
    }
39
40
    public function getCountryCode(): ?int
41
    {
42
        return $this->get('country-code');
43
    }
44
45
    public function getValue(): ?int
46
    {
47
        return $this->get('value');
48
    }
49
50
    public function getWeight(): ?int
51
    {
52
        return $this->get('weight');
53
    }
54
55
    public function getTnvedCode(): ?string
56
    {
57
        return $this->get('tnved-code');
58
    }
59
60
    public function toArray(): array
61
    {
62
        return $this->data;
63
    }
64
}
65