Passed
Push — master ( ae2f5d...4abed5 )
by Jhao
02:33
created

Wrapper::getItems()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 6
rs 10
c 1
b 0
f 0
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
class Wrapper
17
{
18
    /** @var Item[]|Item */
19
    private $Item;
20
21
    /** @var string */
22
    private $DatePreparation;
23
24
    /**
25
     * @return Item[]
26
     */
27
    public function getItems()
28
    {
29
        return $this->Item instanceof Item ? [$this->Item] : $this->Item;
30
    }
31
32
    /**
33
     * @return \DateTimeImmutable
34
     */
35
    public function getPreparedAt(): \DateTimeImmutable
36
    {
37
        return \DateTimeImmutable::createFromFormat(
38
            'd.m.Y h:m:s',
39
            $this->DatePreparation,
40
            new \DateTimeZone('Europe/Moscow')
41
        );
42
    }
43
}
44