LoyaltyUser   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 21
c 2
b 0
f 0
dl 0
loc 82
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoyaltyCardTurnoverByApiKey() 0 13 3
A getLoyaltyInfoByApiKey() 0 5 1
A getStandartCardsList() 0 10 1
A getPromocodeByPhone() 0 7 1
1
<?php
2
3
namespace Daaner\NovaPoshta\Models;
4
5
use Daaner\NovaPoshta\NovaPoshta;
6
use Daaner\NovaPoshta\Traits\Limit;
7
8
class LoyaltyUser extends NovaPoshta
9
{
10
    use Limit;
11
12
    protected $model = 'LoyaltyUser';
13
    protected $calledMethod;
14
    protected $methodProperties = null;
15
16
    /***
17
     * Получение данных по бонусной карте.
18
     *
19
     * @see https://daaner.github.io/NovaPoshta/#/LoyaltyUser?id=getloyaltyinfobyapikey НЕ ДОКУМЕНТИРОВАНО
20
     * @since 2022-11-06
21
     *
22
     * @return array
23
     */
24
    public function getLoyaltyInfoByApiKey(): array
25
    {
26
        $this->calledMethod = 'getLoyaltyInfoByApiKey';
27
28
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
29
    }
30
31
    /**
32
     * Получение данных о входящих посылках.
33
     *
34
     * @since 2022-11-05
35
     *
36
     * @param  string|null  $Year  Год (в формате YYYY)
37
     * @param  string|null  $Month  Месяц (в формате m)
38
     * @return array
39
     */
40
    public function getLoyaltyCardTurnoverByApiKey(?string $Year = null, ?string $Month = null): array
41
    {
42
        $this->calledMethod = 'getLoyaltyCardTurnoverByApiKey';
43
44
        if ($Year) {
45
            $this->methodProperties['Year'] = $Year;
46
        }
47
48
        if ($Month) {
49
            $this->methodProperties['Month'] = $Month;
50
        }
51
52
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
53
    }
54
55
    /**
56
     * Получение активных промокодов прикрепленных к телефону контрагента.
57
     *
58
     * @since 2022-11-06
59
     *
60
     * @param  string  $Phone  Телефон контрагента
61
     * @return array
62
     */
63
    public function getPromocodeByPhone(string $Phone): array
64
    {
65
        $this->calledMethod = 'getPromocodeByPhone';
66
67
        $this->methodProperties['Phone'] = $Phone;
68
69
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
70
    }
71
72
    /**
73
     * Список по бонусной программе контрагента.
74
     *
75
     * @since 2022-11-06
76
     *
77
     * @param  string  $CounterpartyRef  Ref контрагента
78
     * @return array
79
     */
80
    public function getStandartCardsList(string $CounterpartyRef): array
81
    {
82
        $this->calledMethod = 'getStandartCardsList';
83
84
        $this->methodProperties['CounterpartyRef'] = $CounterpartyRef;
85
86
        $this->getLimit();
87
        $this->getPage();
88
89
        return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties, true);
90
    }
91
}
92