Passed
Push — master ( 28b0ab...accbfe )
by Andrey
03:54
created

CounterpartyProperty::getEDRPOU()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Daaner\NovaPoshta\Traits;
4
5
trait CounterpartyProperty
6
{
7
    protected $counterpartyType;
8
    protected $counterpartyProperty;
9
    protected $ownershipForm;
10
    protected $EDRPOU;
11
12
    /**
13
     * @return this
14
     */
15
    public function setCounterpartyType($counterpartyType)
16
    {
17
        $this->counterpartyType = $counterpartyType;
18
19
        return $this;
20
    }
21
22
    /**
23
     * @return this
24
     */
25
    public function setCounterpartyProperty($counterpartyProperty)
26
    {
27
        $this->counterpartyProperty = $counterpartyProperty;
28
29
        return $this;
30
    }
31
32
    /**
33
     * @return this
34
     */
35
    public function setOwnershipForm($ownershipForm)
36
    {
37
        $this->ownershipForm = $ownershipForm;
38
39
        return $this;
40
    }
41
42
    /**
43
     * @return this
44
     */
45
    public function setEDRPOU($EDRPOU)
46
    {
47
        $this->EDRPOU = $EDRPOU;
48
49
        return $this;
50
    }
51
52
    /**
53
     * @return this
54
     */
55
    public function getCounterpartyType()
56
    {
57
        if (! $this->counterpartyType) {
58
            $this->counterpartyType = 'PrivatePerson';
59
        }
60
61
        $this->methodProperties['CounterpartyType'] = $this->counterpartyType;
1 ignored issue
show
Bug Best Practice introduced by
The property methodProperties does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return this
68
     */
69
    public function getCounterpartyProperty()
70
    {
71
        //Сделано для getCounterpartyAddresses,
72
        //однако этот справочник игнорирует СounterpartyProperty в поиске
73
        if ($this->counterpartyProperty == 'All') {
74
            return $this;
75
        }
76
77
        if (! $this->counterpartyProperty) {
78
            $this->counterpartyProperty = 'Recipient';
79
        }
80
81
        $this->methodProperties['CounterpartyProperty'] = $this->counterpartyProperty;
1 ignored issue
show
Bug Best Practice introduced by
The property methodProperties does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
82
83
        return $this;
84
    }
85
86
    /**
87
     * @return this
88
     */
89
    public function getOwnershipForm()
90
    {
91
        if ($this->ownershipForm) {
92
            $this->methodProperties['OwnershipForm'] = $this->ownershipForm;
1 ignored issue
show
Bug Best Practice introduced by
The property methodProperties does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
93
            $this->methodProperties['CounterpartyType'] = 'Organization';
94
            $this->makeOrganization();
95
        }
96
97
        return $this;
98
    }
99
100
    /**
101
     * @return this
102
     */
103
    public function getEDRPOU()
104
    {
105
        if ($this->EDRPOU) {
106
            $this->methodProperties['EDRPOU'] = $this->EDRPOU;
1 ignored issue
show
Bug Best Practice introduced by
The property methodProperties does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
107
            $this->methodProperties['CounterpartyProperty'] = 'ThirdPerson';
108
            $this->makeOrganization();
109
        }
110
111
        return $this;
112
    }
113
114
115
    /**
116
     * Вынесенная логика для удаления контактов
117
     * используется для создания / изменения данных организаций или третьих лиц
118
     * @return this
119
     */
120
    public function makeOrganization()
121
    {
122
        $lastName = '';
0 ignored issues
show
Unused Code introduced by
The assignment to $lastName is dead and can be removed.
Loading history...
123
        $middleName = '';
0 ignored issues
show
Unused Code introduced by
The assignment to $middleName is dead and can be removed.
Loading history...
124
        $phone = '';
0 ignored issues
show
Unused Code introduced by
The assignment to $phone is dead and can be removed.
Loading history...
125
        $email = '';
0 ignored issues
show
Unused Code introduced by
The assignment to $email is dead and can be removed.
Loading history...
126
127
        return $this;
128
    }
129
130
131
}
132