Commune   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 148
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 148
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 30 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 Commune
23
 *
24
 * @package mrcnpdlk\MojePanstwo\Model
25
 */
26
class Commune extends ModelAbstract
27
{
28
    const CONTEXT = 'gminy';
29
30
    /**
31
     * @var int
32
     */
33
    public $wojewodztwo_id;
34
    /**
35
     * @var string
36
     */
37
    public $wojewodztwo_nazwa;
38
    /**
39
     * @var integer
40
     */
41
    public $powiat_id;
42
    /**
43
     * @var string
44
     */
45
    public $powiat_nazwa;
46
    /**
47
     * @var int
48
     */
49
    public $id;
50
    /**
51
     * @var string
52
     */
53
    public $nts;
54
    /**
55
     * @var \mrcnpdlk\MojePanstwo\Model\Address\Nts
56
     */
57
    public $nts_teryt;
58
    /**
59
     * @var string
60
     */
61
    public $teryt;
62
    /**
63
     * @var string
64
     */
65
    public $nazwa;
66
    /**
67
     * @var string
68
     */
69
    public $nazwa_urzedu;
70
    /**
71
     * @var integer
72
     */
73
    public $typ_id;
74
    /**
75
     * @var string
76
     */
77
    public $typ_nazwa;
78
    /**
79
     * @var string
80
     */
81
    public $rada_nazwa;
82
    /**
83
     * @var integer
84
     */
85
    public $szef_stanowisko_id;
86
    /**
87
     * @var string
88
     */
89
    public $adres;
90
    /**
91
     * @var string
92
     */
93
    public $bip_www;
94
    /**
95
     * @var string
96
     */
97
    public $email;
98
    /**
99
     * @var string
100
     */
101
    public $telefon;
102
    /**
103
     * @var string
104
     */
105
    public $fax;
106
    /**
107
     * @var float
108
     */
109
    public $wydatki_roczne;
110
    /**
111
     * @var float
112
     */
113
    public $zadluzenie_roczne;
114
    /**
115
     * @var float
116
     */
117
    public $dochody_roczne;
118
    /**
119
     * @var int
120
     */
121
    public $liczba_ludnosci;
122
    /**
123
     * @var float
124
     */
125
    public $powierzchnia;
126
    /**
127
     * @var string
128
     */
129
    public $powiatowa;
130
    /**
131
     * @var string
132
     */
133
    public $wojewodzka;
134
135
136
    /**
137
     * Commune constructor.
138
     *
139
     * @param \stdClass|null $oData
140
     *
141
     * @throws \mrcnpdlk\MojePanstwo\Exception
142
     */
143 2
    public function __construct(\stdClass $oData = null)
144
    {
145
        /**
146
         * Hack for values with different namespace
147
         */
148 2
        $this->{'wojewodztwa.id'}        = null;
149 2
        $this->{'wojewodztwa.nazwa'}     = null;
150 2
        $this->{'powiaty.id'}            = null;
151 2
        $this->{'powiaty.typ_id'}        = null;
152 2
        $this->{'powiaty.nazwa'}         = null;
153 2
        $this->{'powiaty.sejm_okreg_id'} = null;
154
155 2
        parent::__construct($oData);
156 2
        if ($oData) {
157 2
            $this->id                 = $this->convertToId($this->id);
158 2
            $this->typ_id             = $this->convertToId($this->typ_id);
159 2
            $this->wojewodztwo_id     = $this->convertToId($this->wojewodztwo_id);
160 2
            $this->powiat_id          = $this->convertToId($this->powiat_id);
161 2
            $this->szef_stanowisko_id = $this->convertToId($this->szef_stanowisko_id);
162 2
            $this->telefon            = $this->cleanTelephoneNr($this->telefon);
163 2
            $this->fax                = $this->cleanTelephoneNr($this->fax);
164
165 2
            $this->wojewodztwo_nazwa = $this->{'wojewodztwa.nazwa'};
166 2
            $this->powiat_nazwa      = $this->{'powiaty.nazwa'};
167 2
            $this->powierzchnia      = (float)$this->powierzchnia;
168 2
            $this->zadluzenie_roczne = (float)$this->zadluzenie_roczne;
169 2
            $this->dochody_roczne    = (float)$this->dochody_roczne;
170 2
            $this->nts_teryt         = new Nts($this->nts);
171
        }
172 2
    }
173
}
174