Completed
Pull Request — master (#2)
by Paulius
02:11 queued 41s
created

DeleteShipmentRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace DPD\Interconnector\Request;
4
5
use DPD\Interconnector\Authentication;
6
7
class DeleteShipmentRequest implements RequestInterface
8
{
9
    private $authentication;
10
11
    private $trackingNumbers = [];
12
13
    public function __construct(Authentication $authentication, array $trackingNumbers)
14
    {
15
        $this->authentication = $authentication;
16
        $this->trackingNumbers = $trackingNumbers;
17
    }
18
19
    public function toArray(): array
20
    {
21
        return array_merge(
22
            $this->authentication->toArray(),
23
            ['parcels' => $this->getTrackingNumbers()]
24
        );
25
    }
26
27
    public function getTrackingNumbers(): string
28
    {
29
        return implode('|', $this->trackingNumbers);
30
    }
31
32
    public function getCountry(): string
33
    {
34
        return $this->authentication->country;
35
    }
36
}