LabelsRequest::getTrackingNumbers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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