Passed
Push — master ( 2cdaae...14b6d5 )
by Jhao
02:25
created

EcomData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 26
ccs 0
cts 17
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A withIdentityMethod() 0 5 1
A addService() 0 5 1
A toArray() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), greabock (https://github.com/greabock), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Orders\Entites;
15
16
use Appwilio\RussianPostSDK\Dispatching\DataAware;
17
use Appwilio\RussianPostSDK\Dispatching\Enum\EcomService;
18
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
19
use Appwilio\RussianPostSDK\Dispatching\Enum\EcomIdentityMethod;
20
21
final class EcomData implements Arrayable
22
{
23
    use DataAware;
24
25
    public function __construct(string $id)
26
    {
27
        $this->data['delivery-point-index'] = $id;
28
    }
29
30
    public function withIdentityMethod(EcomIdentityMethod $method)
31
    {
32
        $this->data['identity-methods'][] = $method;
33
34
        return $this;
35
    }
36
37
    public function addService(EcomService $servcie)
38
    {
39
        $this->data['services'][] = $servcie;
40
41
        return $this;
42
    }
43
44
    public function toArray(): array
45
    {
46
        return $this->data;
47
    }
48
}
49