Completed
Push — master ( 88d0d9...a53fa0 )
by Marcin
02:57
created

JednostkaNomenklaturyNTS   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 86.67%

Importance

Changes 0
Metric Value
dl 0
loc 53
ccs 13
cts 15
cp 0.8667
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 3
1
<?php
2
/**
3
 * TERYT-API
4
 *
5
 * Copyright (c) 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
16
/**
17
 * Created by Marcin Pudełek <[email protected]>
18
 * Date: 06.09.2017
19
 */
20
21
namespace mrcnpdlk\Teryt\ResponseModel\Territory;
22
23
/**
24
 * Class JednostkaNomenklaturyNTS
25
 *
26
 * @package mrcnpdlk\Teryt\ResponseModel\Territory
27
 */
28
class JednostkaNomenklaturyNTS extends AbstractResponseModel
29
{
30
    /**
31
     * Jednoznakowy symbol poziomu
32
     *
33
     * @var string
34
     */
35
    public $level;
36
    /**
37
     * Jednoznakowy symbol regionu
38
     *
39
     * @var string
40
     */
41
    public $regionId;
42
    /**
43
     * Dwuznakowy symbol podregionu
44
     *
45
     * @var string
46
     */
47
    public $subregionId;
48
    /**
49
     * Nazwa jednostki
50
     *
51
     * @var string
52
     */
53
    public $name;
54
    /**
55
     * Typ jednostki podziału terytorialnego
56
     *
57
     * @var string
58
     */
59
    public $typeName;
60
61 1
    public function __construct(\stdClass $oData = null)
62
    {
63 1
        parent::__construct($oData);
64 1
        $this->communeId     = $oData->GMI;
65 1
        $this->name          = $oData->NAZWA;
66 1
        $this->typeName      = $oData->NAZWA_DOD;
67 1
        $this->subregionId   = $oData->PODREG;
68 1
        $this->districtId    = $oData->POW;
69 1
        $this->level         = $oData->POZIOM;
70 1
        $this->regionId      = $oData->REGION;
71 1
        $this->communeTypeId = $oData->RODZ;
72 1
        $this->provinceId    = $oData->WOJ;
73
74
        try {
75 1
            $this->statusDate = $oData->STAN_NA ? (new \DateTime($oData->STAN_NA))->format('Y-m-d') : null;
76
        } catch (\Exception $e) {
77
            $this->statusDate = null;
78
        }
79
80 1
        $this->expandData();
81 1
    }
82
}
83