appwilio /
russianpost-sdk
| 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 Item implements \IteratorAggregate |
||
| 17 | { |
||
| 18 | use ErrorAware; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 19 | |||
| 20 | /** @var Error|null */ |
||
| 21 | private $Error; |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | /** @var string */ |
||
| 24 | private $Barcode; |
||
| 25 | |||
| 26 | /** @var TrackingEvent[] */ |
||
| 27 | private $Operation; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Список событий обработки почтового отправления. |
||
| 31 | * |
||
| 32 | * @return TrackingEvent[] |
||
| 33 | */ |
||
| 34 | 1 | public function getEvents() |
|
| 35 | { |
||
| 36 | 1 | return $this->Operation; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Идентификатор (ШПИ) почтового отправления (Barcode). |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 1 | public function getBarcode(): string |
|
| 45 | { |
||
| 46 | 1 | return $this->Barcode; |
|
| 47 | } |
||
| 48 | |||
| 49 | 1 | public function getIterator() |
|
| 50 | { |
||
| 51 | return (function () { |
||
| 52 | 1 | foreach ($this->getEvents() as $event) { |
|
| 53 | 1 | yield $event; |
|
| 54 | } |
||
| 55 | 1 | })(); |
|
| 56 | } |
||
| 57 | } |
||
| 58 |