Conditions | 7 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 7.0671 |
Changes | 0 |
1 | <?php |
||
46 | 3 | public function __construct(\stdClass $oData) |
|
47 | { |
||
48 | 3 | $this->provinceId = $oData->WOJ; |
|
49 | 3 | $this->districtId = $oData->POW; |
|
50 | 3 | $this->communeId = $oData->GMI; |
|
51 | 3 | $this->communeTypeId = $oData->RODZ; |
|
52 | 3 | $this->name = $oData->NAZWA; |
|
53 | 3 | $this->typeName = $oData->NAZWA_DOD; |
|
54 | 3 | $this->statusDate = $oData->STAN_NA; |
|
55 | |||
56 | try { |
||
57 | 3 | $this->statusDate = $oData->STAN_NA ? (new \DateTime($oData->STAN_NA))->format('Y-m-d') : null; |
|
58 | } catch (\Exception $e) { |
||
59 | $this->statusDate = null; |
||
60 | } |
||
61 | |||
62 | 3 | if ($this->provinceId && $this->districtId && $this->communeId && $this->communeTypeId) { |
|
63 | 1 | $this->tercId = (int)sprintf('%s%s%s%s', |
|
64 | 1 | $this->provinceId, |
|
65 | 1 | $this->districtId, |
|
66 | 1 | $this->communeId, |
|
67 | 1 | $this->communeTypeId); |
|
68 | } |
||
69 | |||
70 | 3 | parent::__construct(); |
|
71 | 3 | } |
|
73 |