Passed
Push — master ( 10cd5c...92ee40 )
by Jhao
02:18
created

ItemsWrapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPreparedAt() 0 6 1
A getItems() 0 7 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\Tracking\Packet;
15
16
final class ItemsWrapper
17
{
18
    /** @var Item[]|Item */
19
    private $Item;
20
21
    /** @var string */
22
    private $DatePreparation;
23
24
    /**
25
     * @return Item[]
26
     */
27 1
    public function getItems()
28
    {
29 1
        if ($this->Item instanceof Item) {
30 1
            $this->Item = [$this->Item];
31
        }
32
33 1
        return $this->Item;
34
    }
35
36
    /**
37
     * @return \DateTimeImmutable
38
     */
39 1
    public function getPreparedAt(): \DateTimeImmutable
40
    {
41 1
        return \DateTimeImmutable::createFromFormat(
42 1
            'd.m.Y h:i:s',
43 1
            $this->DatePreparation,
44 1
            new \DateTimeZone('Europe/Moscow')
45
        );
46
    }
47
}
48