PostalObjectReverse::setInvoiceNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
namespace Eduardokum\CorreiosPhp\Entities;
3
4
use Eduardokum\CorreiosPhp\Exception\InvalidArgumentException;
5
use Eduardokum\CorreiosPhp\Traits\MagicTrait;
6
7
class PostalObjectReverse
8
{
9
    use MagicTrait;
10
11
    const TYPE_POST_AUTHORIZATION = 'A';
12
    const TYPE_HOME_WITHDRAWAL_REQUIRED = 'C';
13
    const TYPE_HOME_WITHDRAWAL_NOT_REQUIRED = 'CA';
14
15
    private $tag;
16
    private $tagDv;
17
    /**
18
     * A - Autorização de Postagem
19
     * C - Coleta domiciliária
20
     * CA - Coleta domiciliar
21
     *
22
     * @var string
23
     */
24
    private $type = self::TYPE_POST_AUTHORIZATION;
25
    private $pickupNumber = null;
26
    private $id = '';
27
    private $additionalService = ['025' => '025'];
28
    private $valueDeclared = 0;
29
    private $recipient;
30
    private $recipientDocument;
31
    private $description;
32
    private $invoiceNumber;
33
34
    public function __construct()
35
    {
36
        $this->setRecipient(new Recipient);
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getTag()
43
    {
44
        return $this->tag;
45
    }
46
47
    /**
48
     * @return mixed
49
     */
50
    public function getTagDv()
51
    {
52
        return $this->tagDv;
53
    }
54
55
    /**
56
     * @param mixed $tag
57
     *
58
     * @return PostalObjectReverse
59
     */
60
    public function setTag($tag)
61
    {
62
        $tags = PostalObject::normalizeTag($tag);
63
        $this->tag = $tags['tag'];
64
        $this->tagDv = $tags['tagDv'];
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getType()
73
    {
74
        return $this->type;
75
    }
76
77
    /**
78
     * @param string $type
79
     *
80
     * @return PostalObjectReverse
81
     */
82
    public function setType(string $type)
83
    {
84
        $this->type = $type;
85
86
        return $this;
87
    }
88
89
    /**
90
     * @return int
91
     */
92
    public function getPickupNumber()
93
    {
94
        return $this->pickupNumber;
95
    }
96
97
    /**
98
     * @param int $pickupNumber
99
     *
100
     * @return PostalObjectReverse
101
     */
102
    public function setPickupNumber(int $pickupNumber)
103
    {
104
        $this->pickupNumber = $pickupNumber;
105
106
        return $this;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getId()
113
    {
114
        return $this->id;
115
    }
116
117
    /**
118
     * @param string $id
119
     *
120
     * @return PostalObjectReverse
121
     */
122
    public function setId(string $id)
123
    {
124
        $this->id = $id;
125
126
        return $this;
127
    }
128
129
    /**
130
     * @return mixed
131
     */
132
    public function getValueDeclared()
133
    {
134
        return $this->valueDeclared;
135
    }
136
137
    /**
138
     * @param mixed $valueDeclared
139
     *
140
     * @return PostalObjectReverse
141
     */
142
    public function setValueDeclared($valueDeclared)
143
    {
144
        $this->valueDeclared = $valueDeclared;
145
146
        return $this;
147
    }
148
149
    /**
150
     * @return $this
151
     */
152
    public function addServiceOwnHand()
153
    {
154
        $this->additionalService['002'] = '002';
155
        return $this;
156
    }
157
158
    /**
159
     * @return $this
160
     */
161
    public function addServiceDeclaredValue()
162
    {
163
        $this->additionalService['019'] = '019';
164
        return $this;
165
    }
166
167
    /**
168
     * @return $this
169
     */
170
    public function addServiceNoticeReceipt()
171
    {
172
        $this->additionalService['001'] = '001';
173
        return $this;
174
    }
175
176
    /**
177
     * @return array
178
     */
179
    public function getAdditionalServices()
180
    {
181
        return $this->additionalService;
182
    }
183
184
    /**
185
     * @return Recipient
186
     */
187
    public function getRecipient()
188
    {
189
        return $this->recipient;
190
    }
191
192
    /**
193
     * @param Recipient $recipient
194
     *
195
     * @return PostalObjectReverse
196
     */
197
    public function setRecipient(Recipient $recipient)
198
    {
199
        $this->recipient = $recipient;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getRecipientDocument()
208
    {
209
        return $this->recipientDocument;
210
    }
211
212
    /**
213
     * @param string $recipientDocument
214
     *
215
     * @return PostalObjectReverse
216
     */
217
    public function setRecipientDocument($recipientDocument)
218
    {
219
        $this->recipientDocument = $recipientDocument;
220
221
        return $this;
222
    }
223
224
    /**
225
     * @return mixed
226
     */
227
    public function getDescription()
228
    {
229
        return $this->description;
230
    }
231
232
    /**
233
     * @param mixed $description
234
     *
235
     * @return PostalObjectReverse
236
     */
237
    public function setDescription($description)
238
    {
239
        $this->description = $description;
240
241
        return $this;
242
    }
243
244
245
    /**
246
     * @return mixed
247
     */
248
    public function getInvoiceNumber()
249
    {
250
        return $this->invoiceNumber;
251
    }
252
253
    /**
254
     * @param mixed $invoiceNumber
255
     *
256
     * @return PostalObjectReverse
257
     */
258
    public function setInvoiceNumber($invoiceNumber)
259
    {
260
        $this->invoiceNumber = $invoiceNumber;
261
262
        return $this;
263
    }
264
}
265