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

TrackingResponse::getPreparedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
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 TrackingResponse implements \IteratorAggregate
17
{
18
    use ErrorAware;
0 ignored issues
show
Bug introduced by
The trait Appwilio\RussianPostSDK\Tracking\Packet\ErrorAware requires the property $Error which is not provided by Appwilio\RussianPostSDK\...Packet\TrackingResponse.
Loading history...
19
20
    /** @var Error|null */
21
    private $error;
0 ignored issues
show
introduced by
The private property $error is not used, and could be removed.
Loading history...
22
23
    /** @var Wrapper */
24
    private $value;
25
26
    /**
27
     * Дата и время формирования билета по MSK (UTC+3).
28
     *
29
     * @return \DateTimeImmutable
30
     */
31
    public function getPreparedAt(): \DateTimeImmutable
32
    {
33
        return $this->value->getPreparedAt();
34
    }
35
36
    /**
37
     * Список почтовых отправлений.
38
     *
39
     * @return Item[]
40
     */
41
    public function getItems()
42
    {
43
        return $this->value->getItems();
44
    }
45
46
    public function getIterator()
47
    {
48
        return (function () {
49
            foreach ($this->getItems() as $item) {
50
                yield $item;
51
            }
52
        })();
53
    }
54
}
55