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

EcomData::toArray()   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
/**
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