Passed
Push — main ( ad68f8...37010c )
by Aleksandr
03:12
created

ActTransferReturnResponse::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Responses\Act\TransferReturns;
6
7
use DalliSDK\Models\TransferReturnAct;
8
use DalliSDK\Responses\ResponseInterface;
9
use JMS\Serializer\Annotation as JMS;
10
11
/**
12
 * Сюда мапится ответ на запрос получение актов возврата
13
 *
14
 * @see https://api.dalli-service.com/v1/doc/returnTransfers
15
 *
16
 * @JMS\XmlRoot("returnTransfers")
17
 *
18
 * @template-implements \IteratorAggregate<int, TransferReturnAct>
19
 */
20
class ActTransferReturnResponse implements ResponseInterface, \IteratorAggregate
21
{
22
    /**
23
     * @JMS\Type("array<DalliSDK\Models\TransferReturnAct>")
24
     * @JMS\XmlList(inline = true, entry = "act")
25
     * @var TransferReturnAct[]
26
     */
27
    private array $items = [];
28
29
    /**
30
     * Код ошибки
31
     *
32
     * @JMS\XmlAttribute()
33
     * @JMS\Type("int")
34
     */
35
    private ?int $error = null;
36
37
    /**
38
     * Текст ошибки
39
     *
40
     * @JMS\XmlAttribute()
41
     * @JMS\Type("string")
42
     * @JMS\SerializedName("errormsg")
43
     */
44
    private ?string $errorMsg = null;
45
46
    /**
47
     * @return \Traversable|TransferReturnAct[]
48
     */
49 1
    public function getIterator(): \ArrayIterator
50
    {
51 1
        return new \ArrayIterator($this->getActs());
52
    }
53
54
    /**
55
     * @return TransferReturnAct[]
56
     */
57 2
    public function getActs(): array
58
    {
59 2
        return $this->items;
60
    }
61
62
    /**
63
     * @return int|null
64
     */
65 1
    public function getError(): ?int
66
    {
67 1
        return $this->error;
68
    }
69
70
    /**
71
     * @return string|null
72
     */
73 1
    public function getErrorMsg(): ?string
74
    {
75 1
        return $this->errorMsg;
76
    }
77
}
78