TrackingResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getItems() 0 3 1
A getPreparedAt() 0 3 1
A getIterator() 0 5 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 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 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