Passed
Push — main ( 6bf038...578b82 )
by Aleksandr
03:45 queued 32s
created

DeliveryPrice   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 39
ccs 6
cts 6
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTotal() 0 3 1
A getAdvPrices() 0 3 1
A getIterator() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Models;
6
7
use DalliSDK\Traits\Fillable;
8
use JMS\Serializer\Annotation as JMS;
9
10
/**
11
 * Модель для контейнера стоимости доставки
12
 *
13
 * @see https://api.dalli-service.com/v1/doc/request-delivery-status
14
 * @see \DalliSDK\Models\AdvPrice
15
 * @JMS\XmlRoot("deliveryprice")
16
 *
17
 * @template-implements \IteratorAggregate<mixed, AdvPrice>
18
 */
19
class DeliveryPrice implements \IteratorAggregate
20
{
21
    use Fillable;
22
23
    /**
24
     * @JMS\XmlAttribute()
25
     * @JMS\Type("float")
26
     */
27
    private float $total;
28
29
    /**
30
     * @JMS\Type("array<DalliSDK\Models\AdvPrice>")
31
     * @JMS\XmlList(inline = true, entry = "advprice")
32
     * @var AdvPrice[]
33
     */
34
    private array $advPrices;
35
36
    /**
37
     * @return float
38
     */
39 2
    public function getTotal(): float
40
    {
41 2
        return $this->total;
42
    }
43
44
    /**
45
     * @return AdvPrice[]
46
     */
47 2
    public function getAdvPrices(): array
48
    {
49 2
        return $this->advPrices;
50
    }
51
52
    /**
53
     * @return \Traversable|AdvPrice[]
54
     */
55 1
    public function getIterator(): \ArrayIterator
56
    {
57 1
        return new \ArrayIterator($this->getAdvPrices());
58
    }
59
}
60