Completed
Push — master ( 2671d0...66fada )
by Marcin
04:20
created

Verification::WeryfikujNazwaAdresUlic()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 27
Code Lines 12

Duplication

Lines 27
Ratio 100 %

Importance

Changes 0
Metric Value
dl 27
loc 27
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 6
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.
18
 * Date: 10.09.2017
19
 * Time: 12:53
20
 */
21
22
namespace mrcnpdlk\Teryt\Api;
23
24
25
use mrcnpdlk\Teryt\Client;
26
use mrcnpdlk\Teryt\Helper;
27
use mrcnpdlk\Teryt\ResponseModel\Territory\ZweryfikowanyAdres;
28
use mrcnpdlk\Teryt\ResponseModel\Territory\ZweryfikowanyAdresBezUlic;
29
30
class Verification
31
{
32
    /**
33
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu
34
     * miejscowości. Weryfikacja odbywa się za pomoca identyfikatorów
35
     *
36
     * @param string $cityId
37
     *
38
     * @return ZweryfikowanyAdresBezUlic
39
     */
40 View Code Duplication
    public static function WeryfikujAdresDlaMiejscowosci(string $cityId)
0 ignored issues
show
Duplication introduced by
This method 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...
41
    {
42
        $res   = Client::getInstance()->request('WeryfikujAdresDlaMiejscowosci', ['symbolMsc' => $cityId]);
43
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdresBezUlic');
44
45
        return new ZweryfikowanyAdresBezUlic($oData);
46
    }
47
48
    /**
49
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT,w wersji
50
     * adresowej rejestru do poziomu miejscowości. Weryfikacja odbywa się za pomoca identyfikatorów
51
     *
52
     * @param string $cityId
53
     *
54
     * @return ZweryfikowanyAdresBezUlic
55
     */
56 View Code Duplication
    public static function WeryfikujAdresDlaMiejscowosciAdresowy(string $cityId)
0 ignored issues
show
Duplication introduced by
This method 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...
57
    {
58
        $res   = Client::getInstance()->request('WeryfikujAdresDlaMiejscowosciAdresowy', ['symbolMsc' => $cityId]);
59
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdresBezUlic');
60
61
        return new ZweryfikowanyAdresBezUlic($oData);
62
    }
63
64
    /**
65
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu
66
     * miejscowości. Weryfikacja odbywa się za pomoca nazw
67
     *
68
     * Nazwa miejscowości nie musibyć pełna - nastąpi wtedy wyszkiwanie pełnokontekstowe
69
     * w wtórym zostanie zwrócona tablica wyników
70
     *
71
     * @param string      $provinceName Nazwa województwa
72
     * @param string      $districtName Nazwa powiatu
73
     * @param string      $communeName  Nazwa gminy
74
     * @param string      $cityName     Nazwa miejscowości
75
     * @param string|null $cityTypeName Nazwa typu miejscowości
76
     *
77
     * @return ZweryfikowanyAdresBezUlic[]
78
     */
79 View Code Duplication
    public static function WeryfikujAdresWmiejscowosci(
0 ignored issues
show
Duplication introduced by
This method 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...
80
        string $provinceName,
81
        string $districtName,
82
        string $communeName,
83
        string $cityName,
84
        string $cityTypeName = null
85
    ) {
86
        $answer = [];
87
        $res    = Client::getInstance()->request('WeryfikujAdresWmiejscowosci',
88
            [
89
                'Wojewodztwo' => $provinceName,
90
                'Powiat'      => $districtName,
91
                'Gmina'       => $communeName,
92
                'Miejscowosc' => $cityName,
93
                'Rodzaj'      => $cityTypeName,
94
            ])
95
        ;
96
        foreach (Helper::getPropertyAsArray($res, 'ZweryfikowanyAdresBezUlic') as $p) {
97
            $answer[] = new ZweryfikowanyAdresBezUlic($p);
98
        };
99
100
        return $answer;
101
    }
102
103
    /**
104
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT w wersji adresowej do poziomu
105
     * miejscowości. Weryfikacja odbywa się za pomoca nazw
106
     *
107
     * Nazwa miejscowości nie musibyć pełna - nastąpi wtedy wyszkiwanie pełnokontekstowe
108
     * w wtórym zostanie zwrócona tablica wyników
109
     *
110
     * @param string      $provinceName Nazwa województwa
111
     * @param string      $districtName Nazwa powiatu
112
     * @param string      $communeName  Nazwa gminy
113
     * @param string      $cityName     Nazwa miejscowości
114
     * @param string|null $cityTypeName Nazwa typu miejscowości
115
     *
116
     * @return ZweryfikowanyAdresBezUlic[]
117
     */
118 View Code Duplication
    public static function WeryfikujAdresWmiejscowosciAdresowy(
0 ignored issues
show
Duplication introduced by
This method 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...
119
        string $provinceName,
120
        string $districtName,
121
        string $communeName,
122
        string $cityName,
123
        string $cityTypeName = null
124
    ) {
125
        $answer = [];
126
        $res    = Client::getInstance()->request('WeryfikujAdresWmiejscowosciAdresowy',
127
            [
128
                'Wojewodztwo' => $provinceName,
129
                'Powiat'      => $districtName,
130
                'Gmina'       => $communeName,
131
                'Miejscowosc' => $cityName,
132
                'Rodzaj'      => $cityTypeName,
133
            ])
134
        ;
135
        foreach (Helper::getPropertyAsArray($res, 'ZweryfikowanyAdresBezUlic') as $p) {
136
            $answer[] = new ZweryfikowanyAdresBezUlic($p);
137
        };
138
139
        return $answer;
140
    }
141
142
    /**
143
     * Weryfikuje istnienie wskazanego obiektu w bazie
144
     * TERYT do poziomu ulic.Weryfikacja odbywa się za pomoca nazw
145
     *
146
     * @param string $cityId
147
     * @param string $streetId
148
     *
149
     * @return ZweryfikowanyAdres
150
     */
151 View Code Duplication
    public static function WeryfikujAdresDlaUlic(string $cityId, string $streetId)
0 ignored issues
show
Duplication introduced by
This method 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...
152
    {
153
        $res   = Client::getInstance()->request('WeryfikujAdresDlaUlic', ['symbolMsc' => $cityId, 'SymUl' => $streetId]);
154
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdres');
155
156
        return new ZweryfikowanyAdres($oData);
157
    }
158
159
    /**
160
     * Weryfikuje istnienie wskazanego obiektu w bazie
161
     * TERYT do poziomu ulic w wersji adresowej. Weryfikacja odbywa się za pomoca nazw
162
     *
163
     * @param string $cityId
164
     * @param string $streetId
165
     *
166
     * @return ZweryfikowanyAdres
167
     */
168 View Code Duplication
    public static function WeryfikujAdresDlaUlicAdresowy(string $cityId, string $streetId)
0 ignored issues
show
Duplication introduced by
This method 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...
169
    {
170
        $res   = Client::getInstance()->request('WeryfikujAdresDlaUlicAdresowy', ['symbolMsc' => $cityId, 'SymUl' => $streetId]);
171
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdres');
172
173
        return new ZweryfikowanyAdres($oData);
174
    }
175
176
    /**
177
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu ulic.
178
     * Weryfikacja odbywa się za pomoca nazw
179
     *
180
     * @param string      $provinceName
181
     * @param string      $districtName
182
     * @param string      $communeName
183
     * @param string      $cityName
184
     * @param string|null $cityTypeName
185
     * @param string      $streetName
186
     *
187
     * @return ZweryfikowanyAdres[]
188
     */
189 View Code Duplication
    public static function WeryfikujNazwaAdresUlic(
0 ignored issues
show
Duplication introduced by
This method 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...
190
        string $provinceName,
191
        string $districtName,
192
        string $communeName,
193
        string $cityName,
194
        string $cityTypeName = null,
195
        string $streetName
196
    ) {
197
        $answer = [];
198
        $res    = Client::getInstance()->request('WeryfikujNazwaAdresUlic',
199
            [
200
                'nazwaWoj'         => $provinceName,
201
                'nazwaPow'         => $districtName,
202
                'nazwaGmi'         => $communeName,
203
                'nazwaMiejscowosc' => $cityName,
204
                'rodzajMiejsc'     => $cityTypeName,
205
                'nazwaUlicy'       => $streetName,
206
            ])
207
        ;
208
209
        $tData = Helper::getPropertyAsArray($res, 'ZweryfikowanyAdres');
210
211
        foreach ($tData as $datum) {
212
            $answer[] = new ZweryfikowanyAdres($datum);
213
        }
214
215
        return $answer;
216
    }
217
218
    /**
219
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu ulic w wersji adresowej rejestru.
220
     * Weryfikacja odbywa się za pomoca nazw
221
     *
222
     * @param string      $provinceName
223
     * @param string      $districtName
224
     * @param string      $communeName
225
     * @param string      $cityName
226
     * @param string|null $cityTypeName
227
     * @param string      $streetName
228
     *
229
     * @return ZweryfikowanyAdres[]
230
     */
231 View Code Duplication
    public static function WeryfikujNazwaAdresUlicAdresowy(
0 ignored issues
show
Duplication introduced by
This method 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...
232
        string $provinceName,
233
        string $districtName,
234
        string $communeName,
235
        string $cityName,
236
        string $cityTypeName = null,
237
        string $streetName
238
    ) {
239
        $answer = [];
240
        $res    = Client::getInstance()->request('WeryfikujNazwaAdresUlicAdresowy',
241
            [
242
                'nazwaWoj'         => $provinceName,
243
                'nazwaPow'         => $districtName,
244
                'nazwaGmi'         => $communeName,
245
                'nazwaMiejscowosc' => $cityName,
246
                'rodzajMiejsc'     => $cityTypeName,
247
                'nazwaUlicy'       => $streetName,
248
            ])
249
        ;
250
251
        $tData = Helper::getPropertyAsArray($res, 'ZweryfikowanyAdres');
252
253
        foreach ($tData as $datum) {
254
            $answer[] = new ZweryfikowanyAdres($datum);
255
        }
256
257
        return $answer;
258
    }
259
}
260