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 TrackingResponse implements \IteratorAggregate |
||
17 | { |
||
18 | use ErrorAware; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
19 | |||
20 | /** @var Error|null */ |
||
21 | private $error; |
||
0 ignored issues
–
show
|
|||
22 | |||
23 | /** @var ItemsWrapper */ |
||
24 | private $value; |
||
25 | |||
26 | /** |
||
27 | * Дата и время формирования билета по MSK (UTC+3). |
||
28 | * |
||
29 | * @return \DateTimeImmutable |
||
30 | */ |
||
31 | 1 | public function getPreparedAt(): \DateTimeImmutable |
|
32 | { |
||
33 | 1 | return $this->value->getPreparedAt(); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * Список почтовых отправлений. |
||
38 | * |
||
39 | * @return Item[] |
||
40 | */ |
||
41 | 1 | public function getItems() |
|
42 | { |
||
43 | 1 | return $this->value->getItems(); |
|
44 | } |
||
45 | |||
46 | 1 | public function getIterator() |
|
47 | { |
||
48 | return (function () { |
||
49 | 1 | foreach ($this->getItems() as $item) { |
|
50 | 1 | yield $item; |
|
51 | } |
||
52 | 1 | })(); |
|
53 | } |
||
54 | } |
||
55 |