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
|
|
|
* @author Marcin Pudełek <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Created by Marcin Pudełek <[email protected]> |
16
|
|
|
* Date: 06.09.2017 |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace mrcnpdlk\Teryt\ResponseModel\Territory; |
20
|
|
|
|
21
|
|
|
use stdClass; |
22
|
|
|
use Throwable; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Class WyszukanaUlica |
26
|
|
|
*/ |
27
|
|
|
class WyszukanaUlica extends Ulica |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* Nazwa uliczy cz. 1 |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
public $streetName1; |
35
|
|
|
/** |
36
|
|
|
* Nazwa ulicy cz. 2 |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
public $streetName2; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* WyszukanaUlica constructor. |
44
|
|
|
* |
45
|
|
|
* @param \stdClass|null $oData Obiekt zwrócony z TerytWS1 |
46
|
|
|
* |
47
|
|
|
* @throws \mrcnpdlk\Teryt\Exception |
48
|
|
|
*/ |
49
|
|
|
public function __construct(stdClass $oData = null) |
50
|
|
|
{ |
51
|
|
|
if ($oData) { |
52
|
|
|
$this->streetIdentity = $oData->Cecha; |
53
|
|
|
$this->communeId = $oData->Gmi; |
54
|
|
|
$this->communeName = $oData->Gmina; |
55
|
|
|
$this->cityName = $oData->Miejscowosc; |
56
|
|
|
$this->streetName = $oData->Nazwa; |
57
|
|
|
$this->streetName1 = $oData->Nazwa1; |
58
|
|
|
$this->streetName2 = $oData->Nazwa2; |
59
|
|
|
$this->districtId = $oData->Pow; |
60
|
|
|
$this->districtName = $oData->Powiat; |
61
|
|
|
$this->communeTypeId = $oData->RodzajGminy; |
62
|
|
|
$this->streetId = $oData->Symbol; |
63
|
|
|
$this->cityId = $oData->SymbolSimc; |
64
|
|
|
$this->provinceId = $oData->Woj; |
65
|
|
|
$this->provinceName = $oData->Wojewodztwo; |
66
|
|
|
|
67
|
|
|
try { |
68
|
|
|
$this->statusDate = $oData->DataStanu ? (new \DateTime($oData->DataStanu))->format('Y-m-d') : null; |
69
|
|
|
} catch (Throwable $e) { |
70
|
|
|
$this->statusDate = null; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
parent::__construct(); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|