Tariff   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 2
b 0
f 0
dl 0
loc 30
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CdekSDK2\BaseTypes;
6
7
use JMS\Serializer\Annotation\Type;
8
9
/**
10
 * Class Tarifflist
11
 * @package CdekSDK2\BaseTypes
12
 */
13
class Tariff extends Tarifflist
14
{
15
    /**
16
     * Код тарифа
17
     * @Type("integer")
18
     * @var integer
19
     */
20
    public $tariff_code;
21
22
    /**
23
     * Дополнительные услуги
24
     * @Type("array<CdekSDK2\BaseTypes\Services>")
25
     * @var Services[]
26
     */
27
    public $services;
28
29
    /**
30
     * Intake constructor.
31
     * @param array $param
32
     */
33
    public function __construct(array $param = [])
34
    {
35
        parent::__construct($param);
36
37
        $this->rules['tariff_code'] = 'numeric|required';
38
        $this->rules['services'] = [
39
            '',
40
            function ($value) {
41
                if ($value instanceof Services) {
42
                    return $value->validate();
43
                }
44
            }
45
        ];
46
    }
47
}
48