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

DeleteShipmentRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 10
c 1
b 0
f 1
dl 0
loc 28
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 5 1
A getCountry() 0 3 1
A getTrackingNumbers() 0 3 1
A __construct() 0 4 1
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
}