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

ActTransferReturnResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getErrorMsg() 0 3 1
A getError() 0 3 1
A getActs() 0 3 1
A getIterator() 0 3 1
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