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

ManifestRequest::__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 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace DPD\Interconnector\Request;
4
5
use DPD\Interconnector\Authentication;
6
7
class ManifestRequest implements RequestInterface
8
{
9
    public function __construct(Authentication $authentication, \DateTime $date)
10
    {
11
        $this->authentication = $authentication;
0 ignored issues
show
Bug Best Practice introduced by
The property authentication does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
12
        $this->date = $date;
0 ignored issues
show
Bug Best Practice introduced by
The property date does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
13
    }
14
15
    public function toArray(): array
16
    {
17
        return array_merge(
18
            $this->authentication->toArray(), 
19
            ['date' => $this->date->format("Y-m-d")]
20
        );
21
    }
22
23
    public function getCountry(): string
24
    {
25
        return $this->authentication->country;
26
    }
27
}