District   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 69
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 2
1
<?php
2
/**
3
 * MOJEPANSTWO-API
4
 *
5
 * Copyright © 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author  Marcin Pudełek <[email protected]>
13
 */
14
15
declare (strict_types=1);
16
17
namespace mrcnpdlk\MojePanstwo\Model\Address;
18
19
use mrcnpdlk\MojePanstwo\Model\ModelAbstract;
20
21
/**
22
 * Class District
23
 *
24
 * @package mrcnpdlk\MojePanstwo\Model
25
 */
26
class District extends ModelAbstract
27
{
28
    const CONTEXT = 'powiaty';
29
    /**
30
     * @var integer
31
     */
32
    public $id;
33
    /**
34
     * @var integer
35
     */
36
    public $typ_id;
37
    /**
38
     * @var integer
39
     */
40
    public $wojewodztwo_id;
41
    /**
42
     * @var string
43
     */
44
    public $wojewodztwo_nazwa;
45
    /**
46
     * @var string
47
     */
48
    public $nts;
49
    /**
50
     * NTS data
51
     *
52
     * @var \mrcnpdlk\MojePanstwo\Model\Address\Nts
53
     */
54
    public $nts_teryt;
55
    /**
56
     * @var string
57
     */
58
    public $nazwa;
59
    /**
60
     * @var integer
61
     */
62
    public $senat_okreg_id;
63
    /**
64
     * @var integer
65
     */
66
    public $sejm_okreg_id;
67
68
    /**
69
     * District constructor.
70
     *
71
     * @param \stdClass|null $oData
72
     *
73
     * @throws \mrcnpdlk\MojePanstwo\Exception
74
     */
75 1
    public function __construct(\stdClass $oData = null)
76
    {
77
        /**
78
         * Hack for values with different namespace
79
         */
80 1
        $this->{'wojewodztwa.id'}    = null;
81 1
        $this->{'wojewodztwa.nazwa'} = null;
82
83 1
        parent::__construct($oData);
84 1
        if ($oData) {
85 1
            $this->id                = $this->convertToId($this->id);
86 1
            $this->typ_id            = $this->convertToId($this->typ_id);
87 1
            $this->wojewodztwo_id    = $this->convertToId($this->wojewodztwo_id);
88 1
            $this->senat_okreg_id    = $this->convertToId($this->senat_okreg_id);
89 1
            $this->sejm_okreg_id     = $this->convertToId($this->sejm_okreg_id);
90 1
            $this->wojewodztwo_nazwa = $this->{'wojewodztwa.nazwa'};
91 1
            $this->nts_teryt         = new Nts($this->nts);
92
        }
93 1
    }
94
}
95