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

CustomsDeclarationItem   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 53
ccs 0
cts 42
cp 0
rs 10
c 1
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getTnvedCode() 0 3 1
A __construct() 0 14 1
A getDescription() 0 3 1
A getCountryCode() 0 3 1
A getQuantity() 0 3 1
A getWeight() 0 3 1
A getValue() 0 3 1
A toArray() 0 3 1
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