Completed
Push — master ( 74d8cf...88d0d9 )
by Marcin
02:58
created

WyszukanaMiejscowosc::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 22
Code Lines 17

Duplication

Lines 22
Ratio 100 %

Code Coverage

Tests 15
CRAP Score 3.0146

Importance

Changes 0
Metric Value
cc 3
eloc 17
nc 4
nop 1
dl 22
loc 22
ccs 15
cts 17
cp 0.8824
crap 3.0146
rs 9.2
c 0
b 0
f 0
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 WyszukanaMiejscowosc
25
 *
26
 * @package mrcnpdlk\Teryt\ResponseModel\Territory
27
 */
28 View Code Duplication
class WyszukanaMiejscowosc extends Miejscowosc
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
{
30
    /**
31
     * Identyfikator miejscowości podstawowej
32
     *
33
     * @var string
34
     */
35
    public $cityParentId;
36
    /**
37
     * Symbol rodzaju miejscowości
38
     *
39
     * @var string
40
     */
41
    public $rmId;
42
    /**
43
     * Nazwa rodzaju miejscowości
44
     *
45
     * @var string
46
     */
47
    public $rmName;
48
49
    /**
50
     * WyszukanaMiejscowosc constructor.
51
     *
52
     * @param \stdClass $oData Obiekt zwrócony z TerytWS1
53
     */
54 1
    public function __construct(\stdClass $oData)
55
    {
56 1
        $this->communeId     = $oData->Gmi;
57 1
        $this->communeName   = $oData->Gmina;
58 1
        $this->cityName      = $oData->Nazwa;
59 1
        $this->districtId    = $oData->Pow;
60 1
        $this->districtName  = $oData->Powiat;
61 1
        $this->rmId          = $oData->Rm;
62 1
        $this->rmName        = $oData->RodzajMiejscowosci;
63 1
        $this->communeTypeId = $oData->RodzajGminy;
64 1
        $this->cityId        = $oData->Symbol;
65 1
        $this->cityParentId  = $oData->SymbolPodst;
66 1
        $this->provinceId    = $oData->Woj;
67 1
        $this->provinceName  = $oData->Wojewodztwo;
68
69
        try {
70 1
            $this->statusDate = $oData->DataStanu ? (new \DateTime($oData->DataStanu))->format('Y-m-d') : null;
71
        } catch (\Exception $e) {
72
            $this->statusDate = null;
73
        }
74
75 1
        parent::__construct();
76 1
    }
77
78
}
79