CollectionForElectricityInvoices::toArray()   F
last analyzed

Complexity

Conditions 14
Paths 8192

Size

Total Lines 45

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 210

Importance

Changes 0
Metric Value
dl 0
loc 45
ccs 0
cts 29
cp 0
rs 2.1
c 0
b 0
f 0
cc 14
nc 8192
nop 0
crap 210

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Billogram\Model\Invoice;
6
7
use Billogram\Model\CreatableFromArray;
8
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12
class CollectionForElectricityInvoices implements CreatableFromArray
13
{
14
    /**
15
     * @var int
16
     */
17
    private $kommunkod;
18
19
    /**
20
     * @var bool
21
     */
22
    private $naringsidkare;
23
24
    /**
25
     * @var bool
26
     */
27
    private $avflyttad;
28
29
    /**
30
     * var string $avflyttadDatum.
31
     */
32
    private $avflyttadDatum;
33
34
    /**
35
     * @var bool
36
     */
37
    private $frankopplad;
38
39
    /**
40
     * @var string
41
     */
42
    private $frankoppladDatum;
43
44
    /**
45
     * @var string
46
     */
47
    private $anladr;
48
49
    /**
50
     * @var string
51
     */
52
    private $natom;
53
54
    /**
55
     * @var int
56
     */
57
    private $arsforb;
58
59
    /**
60
     * @var string
61
     */
62
    private $anlid;
63
64
    /**
65
     * @var string
66
     */
67
    private $kravmall;
68
69
    /**
70
     * @var string
71
     */
72
    private $plombkod;
73
74
    /**
75
     * @var bool
76
     */
77
    private $slutfaktura;
78
79
    /**
80
     * @return int
81
     */
82
    public function getKommunkod(): int
83
    {
84
        return $this->kommunkod;
85
    }
86
87
    /**
88
     * @param int $kommunkod
89
     *
90
     * @return CollectionForElectricityInvoices
91
     */
92
    public function withKommunkod(int $kommunkod)
93
    {
94
        $new = clone $this;
95
        $new->kommunkod = $kommunkod;
96
97
        return $new;
98
    }
99
100
    /**
101
     * @return bool
102
     */
103
    public function isNaringsidkare(): bool
104
    {
105
        return $this->naringsidkare;
106
    }
107
108
    /**
109
     * @param bool $naringsidkare
110
     *
111
     * @return CollectionForElectricityInvoices
112
     */
113
    public function withNaringsidkare(bool $naringsidkare)
114
    {
115
        $new = clone $this;
116
        $new->naringsidkare = $naringsidkare;
117
118
        return $new;
119
    }
120
121
    /**
122
     * @return bool
123
     */
124
    public function isAvflyttad(): bool
125
    {
126
        return $this->avflyttad;
127
    }
128
129
    /**
130
     * @param bool $avflyttad
131
     *
132
     * @return CollectionForElectricityInvoices
133
     */
134
    public function withAvflyttad(bool $avflyttad)
135
    {
136
        $new = clone $this;
137
        $new->avflyttad = $avflyttad;
138
139
        return $new;
140
    }
141
142
    /**
143
     * @return mixed
144
     */
145
    public function getAvflyttadDatum()
146
    {
147
        return $this->avflyttadDatum;
148
    }
149
150
    /**
151
     * @param mixed $avflyttadDatum
152
     *
153
     * @return CollectionForElectricityInvoices
154
     */
155
    public function withAvflyttadDatum($avflyttadDatum)
156
    {
157
        $new = clone $this;
158
        $new->avflyttadDatum = $avflyttadDatum;
159
160
        return $new;
161
    }
162
163
    /**
164
     * @return bool
165
     */
166
    public function isFrankopplad(): bool
167
    {
168
        return $this->frankopplad;
169
    }
170
171
    /**
172
     * @param bool $frankopplad
173
     *
174
     * @return CollectionForElectricityInvoices
175
     */
176
    public function withFrankopplad(bool $frankopplad)
177
    {
178
        $new = clone $this;
179
        $new->frankopplad = $frankopplad;
180
181
        return $new;
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getFrankoppladDatum(): string
188
    {
189
        return $this->frankoppladDatum;
190
    }
191
192
    /**
193
     * @param string $frankoppladDatum
194
     *
195
     * @return CollectionForElectricityInvoices
196
     */
197
    public function withFrankoppladDatum(string $frankoppladDatum)
198
    {
199
        $new = clone $this;
200
        $new->frankoppladDatum = $frankoppladDatum;
201
202
        return $new;
203
    }
204
205
    /**
206
     * @return string
207
     */
208
    public function getAnladr(): string
209
    {
210
        return $this->anladr;
211
    }
212
213
    /**
214
     * @param string $anladr
215
     *
216
     * @return CollectionForElectricityInvoices
217
     */
218
    public function withAnladr(string $anladr)
219
    {
220
        $new = clone $this;
221
        $new->anladr = $anladr;
222
223
        return $new;
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getNatom(): string
230
    {
231
        return $this->natom;
232
    }
233
234
    /**
235
     * @param string $natom
236
     *
237
     * @return CollectionForElectricityInvoices
238
     */
239
    public function withNatom(string $natom)
240
    {
241
        $new = clone $this;
242
        $new->natom = $natom;
243
244
        return $new;
245
    }
246
247
    /**
248
     * @return int
249
     */
250
    public function getArsforb(): int
251
    {
252
        return $this->arsforb;
253
    }
254
255
    /**
256
     * @param int $arsforb
257
     *
258
     * @return CollectionForElectricityInvoices
259
     */
260
    public function withArsforb(int $arsforb)
261
    {
262
        $new = clone $this;
263
        $new->arsforb = $arsforb;
264
265
        return $new;
266
    }
267
268
    /**
269
     * @return string
270
     */
271
    public function getAnlid(): string
272
    {
273
        return $this->anlid;
274
    }
275
276
    /**
277
     * @param string $anlid
278
     *
279
     * @return CollectionForElectricityInvoices
280
     */
281
    public function withAnlid(string $anlid)
282
    {
283
        $new = clone $this;
284
        $new->anlid = $anlid;
285
286
        return $new;
287
    }
288
289
    /**
290
     * @return string
291
     */
292
    public function getKravmall(): string
293
    {
294
        return $this->kravmall;
295
    }
296
297
    /**
298
     * @param string $kravmall
299
     *
300
     * @return CollectionForElectricityInvoices
301
     */
302
    public function withKravmall(string $kravmall)
303
    {
304
        $new = clone $this;
305
        $new->kravmall = $kravmall;
306
307
        return $new;
308
    }
309
310
    /**
311
     * @return string
312
     */
313
    public function getPlombkod(): string
314
    {
315
        return $this->plombkod;
316
    }
317
318
    /**
319
     * @param string $plombkod
320
     *
321
     * @return CollectionForElectricityInvoices
322
     */
323
    public function withPlombkod(string $plombkod)
324
    {
325
        $new = clone $this;
326
        $new->plombkod = $plombkod;
327
328
        return $new;
329
    }
330
331
    /**
332
     * @return bool
333
     */
334
    public function isSlutfaktura(): bool
335
    {
336
        return $this->slutfaktura;
337
    }
338
339
    /**
340
     * @param bool $slutfaktura
341
     *
342
     * @return CollectionForElectricityInvoices
343
     */
344
    public function withSlutfaktura(bool $slutfaktura)
345
    {
346
        $new = clone $this;
347
        $new->slutfaktura = $slutfaktura;
348
349
        return $new;
350
    }
351
352
    public function toArray()
353
    {
354
        $data = [];
355
        if (null !== $this->kommunkod) {
356
            $data['kommunkod'] = $this->kommunkod;
357
        }
358
        if (null !== $this->naringsidkare) {
359
            $data['naringsidkare'] = $this->naringsidkare;
360
        }
361
        if (null !== $this->avflyttad) {
362
            $data['avflyttad'] = $this->avflyttad;
363
        }
364
        if (null !== $this->avflyttadDatum) {
365
            $data['avflyttad_datum'] = $this->avflyttadDatum;
366
        }
367
        if (null !== $this->frankopplad) {
368
            $data['frankopplad'] = $this->frankopplad;
369
        }
370
        if (null !== $this->frankoppladDatum) {
371
            $data['frankopplad_datum'] = $this->frankoppladDatum;
372
        }
373
        if (null !== $this->anladr) {
374
            $data['anladr'] = $this->anladr;
375
        }
376
        if (null !== $this->natom) {
377
            $data['natom'] = $this->natom;
378
        }
379
        if (null !== $this->arsforb) {
380
            $data['arsforb'] = $this->arsforb;
381
        }
382
        if (null !== $this->anlid) {
383
            $data['anlid'] = $this->anlid;
384
        }
385
        if (null !== $this->kravmall) {
386
            $data['kravmall'] = $this->kravmall;
387
        }
388
        if (null !== $this->plombkod) {
389
            $data['plombkod'] = $this->plombkod;
390
        }
391
        if (null !== $this->slutfaktura) {
392
            $data['slutfaktura'] = $this->slutfaktura;
393
        }
394
395
        return $data;
396
    }
397
398
    /**
399
     * Create an API response object from the HTTP response from the API server.
400
     *
401
     * @param array $data
402
     *
403
     * @return self
404
     */
405 3
    public static function createFromArray(array $data)
406
    {
407 3
        $collection = new self();
408 3
        $collection->kommunkod = $data['kommunkod'] ?? null;
409 3
        $collection->naringsidkare = $data['naringsidkare'] ?? null;
410 3
        $collection->avflyttad = $data['avflyttad'] ?? null;
411 3
        $collection->avflyttadDatum = $data['avflyttad_datum'] ?? null;
412 3
        $collection->frankopplad = $data['frankopplad'] ?? null;
413 3
        $collection->frankoppladDatum = $data['frankopplad_datum'] ?? null;
414 3
        $collection->anladr = $data['anladr'] ?? null;
415 3
        $collection->natom = $data['natom'] ?? null;
416 3
        $collection->arsforb = $data['arsforb'] ?? null;
417 3
        $collection->anlid = $data['anlid'] ?? null;
418 3
        $collection->kravmall = $data['kravmall'] ?? null;
419 3
        $collection->plombkod = $data['plombkod'] ?? null;
420 3
        $collection->slutfaktura = $data['slutfaktura'] ?? null;
421
422 3
        return $collection;
423
    }
424
}
425