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

NativeApi::PobierzZmianyTercAdresowy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 2
dl 14
loc 14
ccs 10
cts 10
cp 1
crap 1
rs 9.4285
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.
18
 * Date: 11.09.2017
19
 * Time: 23:01
20
 */
21
22
namespace mrcnpdlk\Teryt;
23
24
use mrcnpdlk\Teryt\Model\Terc;
25
use mrcnpdlk\Teryt\ResponseModel\Dictionary\RodzajMiejscowosci;
26
use mrcnpdlk\Teryt\ResponseModel\Territory\JednostkaNomenklaturyNTS;
27
use mrcnpdlk\Teryt\ResponseModel\Territory\JednostkaPodzialuTerytorialnego;
28
use mrcnpdlk\Teryt\ResponseModel\Territory\JednostkaTerytorialna;
29
use mrcnpdlk\Teryt\ResponseModel\Territory\Miejscowosc;
30
use mrcnpdlk\Teryt\ResponseModel\Territory\Ulica;
31
use mrcnpdlk\Teryt\ResponseModel\Territory\UlicaDrzewo;
32
use mrcnpdlk\Teryt\ResponseModel\Territory\WyszukanaMiejscowosc;
33
use mrcnpdlk\Teryt\ResponseModel\Territory\WyszukanaUlica;
34
use mrcnpdlk\Teryt\ResponseModel\Territory\ZweryfikowanyAdres;
35
use mrcnpdlk\Teryt\ResponseModel\Territory\ZweryfikowanyAdresBezUlic;
36
37
38
final class NativeApi
39
{
40
    /**
41
     * @var string Wyszukiwanie wśród wszystkich rodzajów jednostek
42
     */
43
    const CATEGORY_ALL         = '0'; // Wyszukiwanie wśród wszystkich rodzajów jednostek
44
    const CATEGORY_WOJ_ALL     = '1'; // Dla województw
45
    const CATEGORY_POW_ALL     = '2'; // Dla wszystkich powiatów
46
    const CATEGORY_POW_ZIE     = '21'; // Dla powiatów ziemskich (identyfikator powiatu 01-60)
47
    const CATEGORY_POW_MIA     = '22'; // Dla miast na prawach powiatu (identyfikator powiatu 61-99)
48
    const CATEGORY_GMI_ALL     = '3'; // Dla gmin ogółem
49
    const CATEGORY_GMI_MIA     = '31'; // Dla gmin miejskich (identyfikator rodzaju gminy 1)
50
    const CATEGORY_DELEG       = '32'; // Dla dzielnic i delegatur (identyfikator rodzaju 8 i 9)
51
    const CATEGORY_GMI_WIE     = '33'; // Dla gmin wiejskich (identyfikator rodzaju 2)
52
    const CATEGORY_GMI_MIE_WIE = '34'; // Dla gmin miejsko-wiejskich (3)
53
    const CATEGORY_MIA         = '341'; // Dla miast w gminach miejsko-wiejskich(4)
54
    const CATEGORY_MIA_OBS     = '342'; // Dla obszarów miejskich w gminach miejsko-wiejskich(5)
55
    const CATEGORY_MIA_ALL     = '35'; // Dla miast ogółem (identyfikator 1 i 4)
56
    const CATEGORY_WIE         = '36'; // Dla terenów wiejskich (identyfikator 2 i 5)
57
58
    /**
59
     * Określenie zakresu miejscowości
60
     */
61
62
    const SEARCH_CITY_TYPE_ALL  = '000'; //Wszystkie
63
    const SEARCH_CITY_TYPE_MAIN = '001'; //Miejscowości podstawowe
64
    const SEARCH_CITY_TYPE_ADD  = '002'; //Części integralne miejscowości
65
66
    /**
67
     * @var \mrcnpdlk\Teryt\NativeApi|null
68
     */
69
    protected static $instance = null;
70
    /**
71
     * @var Client
72
     */
73
    protected $oClient;
74
75
    /**
76
     * NativeApi constructor.
77
     *
78
     * @param \mrcnpdlk\Teryt\Client $oClient
79
     */
80 11
    protected function __construct(Client $oClient)
81
    {
82 11
        $this->oClient = $oClient;
83 11
    }
84
85
    /**
86
     * @param \mrcnpdlk\Teryt\Client $oClient
87
     *
88
     * @return \mrcnpdlk\Teryt\NativeApi
89
     */
90 11
    public static function create(Client $oClient)
91
    {
92 11
        static::$instance = new static($oClient);
93
94 11
        return static::$instance;
95
    }
96
97
    /**
98
     * @return \mrcnpdlk\Teryt\NativeApi
99
     * @throws \mrcnpdlk\Teryt\Exception
100
     */
101 2
    public static function getInstance()
102
    {
103 2
        if (!isset(static::$instance)) {
104
            throw new Exception(sprintf('First call CREATE method!'));
105
        }
106
107 2
        return static::$instance;
108
    }
109
110
    /**
111
     * Sprawdzenie czy użytkownik jest zalogowany
112
     *
113
     * @return bool
114
     */
115 1
    public function CzyZalogowany()
116
    {
117 1
        $res = $this->oClient->request('CzyZalogowany');
118
119 1
        return $res;
120
    }
121
122
    /**
123
     * Data początkowa bieżącego stanu katalogu TERC
124
     *
125
     * @return null|string Data w formacie YYY-MM-DD
126
     */
127 View Code Duplication
    public function PobierzDateAktualnegoKatTerc()
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...
128
    {
129
        $res = $this->oClient->request('PobierzDateAktualnegoKatTerc');
130
131
        try {
132
            return (new \DateTime($res))->format('Y-m-d');
133
        } catch (\Exception $e) {
134
            return null;
135
        }
136
    }
137
138
    /**
139
     * Data początkowa bieżącego stanu katalogu NTS
140
     *
141
     * @return null|string Data w formacie YYY-MM-DD
142
     */
143 View Code Duplication
    public function PobierzDateAktualnegoKatNTS()
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...
144
    {
145
        $res = $this->oClient->request('PobierzDateAktualnegoKatNTS');
146
147
        try {
148
            return (new \DateTime($res))->format('Y-m-d');
149
        } catch (\Exception $e) {
150
            return null;
151
        }
152
    }
153
154
    /**
155
     * Data początkowa bieżącego stanu katalogu SIMC
156
     *
157
     * @return null|string Data w formacie YYY-MM-DD
158
     */
159 View Code Duplication
    public function PobierzDateAktualnegoKatSimc()
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...
160
    {
161
        $res = $this->oClient->request('PobierzDateAktualnegoKatSimc');
162
163
        try {
164
            return (new \DateTime($res))->format('Y-m-d');
165
        } catch (\Exception $e) {
166
            return null;
167
        }
168
    }
169
170
    /**
171
     * Data początkowa bieżącego stanu katalogu ULIC
172
     *
173
     * @return null|string Data w formacie YYY-MM-DD
174
     */
175 View Code Duplication
    public function PobierzDateAktualnegoKatUlic()
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...
176
    {
177
        $res = $this->oClient->request('PobierzDateAktualnegoKatUlic');
178
179
        try {
180
            return (new \DateTime($res))->format('Y-m-d');
181
        } catch (\Exception $e) {
182
            return null;
183
        }
184
    }
185
186
    /**
187
     * Dane z systemu identyfikatorów TERC z wybranego stanu katalogu w wersji adresowej
188
     *
189
     * @return \SplFileObject
190
     */
191 View Code Duplication
    public function PobierzKatalogTERCAdr(): \SplFileObject
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...
192
    {
193
        $res     = $this->oClient->request('PobierzKatalogTERCAdr');
194
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
195
        $content = base64_decode($res->plik_zawartosc);
196
197
        return Helper::saveFile($sPath, $content);
198
    }
199
200
    /**
201
     * Dane z systemu identyfikatorów TERC z wybranego stanu katalogu w wersji urzędowej
202
     *
203
     * @return \SplFileObject
204
     */
205 View Code Duplication
    public function PobierzKatalogTERC(): \SplFileObject
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...
206
    {
207
        $res     = $this->oClient->request('PobierzKatalogTERC');
208
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
209
        $content = base64_decode($res->plik_zawartosc);
210
211
        return Helper::saveFile($sPath, $content);
212
    }
213
214
    /**
215
     * Identyfikatory i nazwy jednostek nomenklatury z wybranego stanu katalogu
216
     *
217
     * @return \SplFileObject
218
     */
219 View Code Duplication
    public function PobierzKatalogNTS(): \SplFileObject
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...
220
    {
221
        $res     = $this->oClient->request('PobierzKatalogNTS');
222
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
223
        $content = base64_decode($res->plik_zawartosc);
224
225
        return Helper::saveFile($sPath, $content);
226
    }
227
228
    /**
229
     * Dane o miejscowościach z systemu identyfikatorów SIMC z wybranego stanu katalogu w wersji adresowej
230
     *
231
     * @return \SplFileObject
232
     */
233 View Code Duplication
    public function PobierzKatalogSIMCAdr(): \SplFileObject
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...
234
    {
235
        $res     = $this->oClient->request('PobierzKatalogSIMCAdr');
236
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
237
        $content = base64_decode($res->plik_zawartosc);
238
239
        return Helper::saveFile($sPath, $content);
240
    }
241
242
    /**
243
     * Dane o miejscowościach z systemu identyfikatorów SIMC z wybranego stanu katalogu w wersji adresowej
244
     *
245
     * @return \SplFileObject
246
     */
247 View Code Duplication
    public function PobierzKatalogSIMC(): \SplFileObject
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...
248
    {
249
        $res     = $this->oClient->request('PobierzKatalogSIMC');
250
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
251
        $content = base64_decode($res->plik_zawartosc);
252
253
        return Helper::saveFile($sPath, $content);
254
    }
255
256
    /**
257
     * Dane o miejscowościach z systemu identyfikatorów SIMC z wybranego stanu katalogu w wersji adresowej
258
     *
259
     * @return \SplFileObject
260
     */
261 View Code Duplication
    public function PobierzKatalogSIMCStat(): \SplFileObject
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...
262
    {
263
        $res     = $this->oClient->request('PobierzKatalogSIMCStat');
264
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
265
        $content = base64_decode($res->plik_zawartosc);
266
267
        return Helper::saveFile($sPath, $content);
268
    }
269
270
    /**
271
     * Katalog ulic dla wskazanego stanu w wersji urzędowej
272
     *
273
     * @return \SplFileObject
274
     */
275 View Code Duplication
    public function PobierzKatalogULIC(): \SplFileObject
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...
276
    {
277
        $res     = $this->oClient->request('PobierzKatalogULIC');
278
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
279
        $content = base64_decode($res->plik_zawartosc);
280
281
        return Helper::saveFile($sPath, $content);
282
    }
283
284
    /**
285
     * Katalog ulic dla wskazanego stanu w wersji adresowej
286
     *
287
     * @return \SplFileObject
288
     */
289 View Code Duplication
    public function PobierzKatalogULICAdr(): \SplFileObject
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...
290
    {
291
        $res     = $this->oClient->request('PobierzKatalogULICAdr');
292
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
293
        $content = base64_decode($res->plik_zawartosc);
294
295
        return Helper::saveFile($sPath, $content);
296
    }
297
298
    /**
299
     * Katalog ulic dla wskazanego stanu w wersji urzędowej zmodyfikowany dla miast posiadający delegatury
300
     *
301
     * @return \SplFileObject
302
     */
303 View Code Duplication
    public function PobierzKatalogULICBezDzielnic(): \SplFileObject
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...
304
    {
305
        $res     = $this->oClient->request('PobierzKatalogULICBezDzielnic');
306
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
307
        $content = base64_decode($res->plik_zawartosc);
308
309
        return Helper::saveFile($sPath, $content);
310
    }
311
312
    /**
313
     * Katalog rodzajów miejscowości dla wskazanego stanu
314
     *
315
     * @return \SplFileObject
316
     */
317 1 View Code Duplication
    public function PobierzKatalogWMRODZ(): \SplFileObject
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...
318
    {
319 1
        $res     = $this->oClient->request('PobierzKatalogWMRODZ');
320 1
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
321 1
        $content = base64_decode($res->plik_zawartosc);
322
323 1
        return Helper::saveFile($sPath, $content);
324
    }
325
326
    /**
327
     * Zmiany w katalogu TERC w wersji urzędowej rejestru
328
     *
329
     * @param \DateTime      $fromDate
330
     * @param \DateTime|null $toDate
331
     *
332
     * @return \SplFileObject
333
     */
334 View Code Duplication
    public function PobierzZmianyTercUrzedowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
335
    {
336
        $toDate  = $toDate ?? new \DateTime();
337
        $res     = $this->oClient->request(
338
            'PobierzZmianyTercUrzedowy',
339
            [
340
                'stanod' => $fromDate->format('Y-m-d'),
341
                'stando' => $toDate->format('Y-m-d'),
0 ignored issues
show
Bug introduced by
The method format() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

341
                'stando' => $toDate->/** @scrutinizer ignore-call */ format('Y-m-d'),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
342
            ],
343
            false);
344
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
345
        $content = base64_decode($res->plik_zawartosc);
346
347
        return Helper::saveFile($sPath, $content);
348
    }
349
350
    /**
351
     * Zmiany w katalogu TERC w wersji adresowej rejestru
352
     *
353
     * @param \DateTime      $fromDate
354
     * @param \DateTime|null $toDate
355
     *
356
     * @return \SplFileObject
357
     */
358 1 View Code Duplication
    public function PobierzZmianyTercAdresowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
359
    {
360 1
        $toDate  = $toDate ?? new \DateTime();
361 1
        $res     = $this->oClient->request(
362 1
            'PobierzZmianyTercAdresowy',
363
            [
364 1
                'stanod' => $fromDate->format('Y-m-d'),
365 1
                'stando' => $toDate->format('Y-m-d'),
366
            ],
367 1
            false);
368 1
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
369 1
        $content = base64_decode($res->plik_zawartosc);
370
371 1
        return Helper::saveFile($sPath, $content);
372
    }
373
374
    /**
375
     * Zmiany w katalogu TERC w wersji adresowej rejestru
376
     *
377
     * @param \DateTime      $fromDate
378
     * @param \DateTime|null $toDate
379
     *
380
     * @return \SplFileObject
381
     */
382 View Code Duplication
    public function PobierzZmianyNTS(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
383
    {
384
        $toDate  = $toDate ?? new \DateTime();
385
        $res     = $this->oClient->request(
386
            'PobierzZmianyNTS',
387
            [
388
                'stanod' => $fromDate->format('Y-m-d'),
389
                'stando' => $toDate->format('Y-m-d'),
390
            ],
391
            false);
392
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
393
        $content = base64_decode($res->plik_zawartosc);
394
395
        return Helper::saveFile($sPath, $content);
396
    }
397
398
    /**
399
     * Zmiany w katalogu SIMC w wersji urzędowej rejestru
400
     *
401
     * @param \DateTime      $fromDate
402
     * @param \DateTime|null $toDate
403
     *
404
     * @return \SplFileObject
405
     */
406 View Code Duplication
    public function PobierzZmianySimcUrzedowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
407
    {
408
        $toDate  = $toDate ?? new \DateTime();
409
        $res     = $this->oClient->request(
410
            'PobierzZmianySimcUrzedowy',
411
            [
412
                'stanod' => $fromDate->format('Y-m-d'),
413
                'stando' => $toDate->format('Y-m-d'),
414
            ],
415
            false);
416
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
417
        $content = base64_decode($res->plik_zawartosc);
418
419
        return Helper::saveFile($sPath, $content);
420
    }
421
422
    /**
423
     * Zmiany w katalogu SIMC w wersji adresowej rejestru
424
     *
425
     * @param \DateTime      $fromDate
426
     * @param \DateTime|null $toDate
427
     *
428
     * @return \SplFileObject
429
     */
430 View Code Duplication
    public function PobierzZmianySimcAdresowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
431
    {
432
        $toDate  = $toDate ?? new \DateTime();
433
        $res     = $this->oClient->request(
434
            'PobierzZmianySimcAdresowy',
435
            [
436
                'stanod' => $fromDate->format('Y-m-d'),
437
                'stando' => $toDate->format('Y-m-d'),
438
            ],
439
            false);
440
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
441
        $content = base64_decode($res->plik_zawartosc);
442
443
        return Helper::saveFile($sPath, $content);
444
    }
445
446
    /**
447
     * Zmiany w katalogu SIMC w wersji statystycznej rejestru
448
     *
449
     * @param \DateTime      $fromDate
450
     * @param \DateTime|null $toDate
451
     *
452
     * @return \SplFileObject
453
     */
454 View Code Duplication
    public function PobierzZmianySimcStatystyczny(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
455
    {
456
        $toDate  = $toDate ?? new \DateTime();
457
        $res     = $this->oClient->request(
458
            'PobierzZmianySimcStatystyczny',
459
            [
460
                'stanod' => $fromDate->format('Y-m-d'),
461
                'stando' => $toDate->format('Y-m-d'),
462
            ],
463
            false);
464
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
465
        $content = base64_decode($res->plik_zawartosc);
466
467
        return Helper::saveFile($sPath, $content);
468
    }
469
470
    /**
471
     * Zmiany w katalogu ULIC w wersji urzędowej rejestru
472
     *
473
     * @param \DateTime      $fromDate
474
     * @param \DateTime|null $toDate
475
     *
476
     * @return \SplFileObject
477
     */
478 View Code Duplication
    public function PobierzZmianyUlicUrzedowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
479
    {
480
        $toDate  = $toDate ?? new \DateTime();
481
        $res     = $this->oClient->request(
482
            'PobierzZmianyUlicUrzedowy',
483
            [
484
                'stanod' => $fromDate->format('Y-m-d'),
485
                'stando' => $toDate->format('Y-m-d'),
486
            ],
487
            false);
488
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
489
        $content = base64_decode($res->plik_zawartosc);
490
491
        return Helper::saveFile($sPath, $content);
492
    }
493
494
    /**
495
     * Zmiany w katalogu ULIC w wersji adresowej rejestru
496
     *
497
     * @param \DateTime      $fromDate
498
     * @param \DateTime|null $toDate
499
     *
500
     * @return \SplFileObject
501
     */
502 View Code Duplication
    public function PobierzZmianyUlicAdresowy(\DateTime $fromDate, \DateTime $toDate = null): \SplFileObject
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...
503
    {
504
        $toDate  = $toDate ?? new \DateTime();
505
        $res     = $this->oClient->request(
506
            'PobierzZmianyUlicAdresowy',
507
            [
508
                'stanod' => $fromDate->format('Y-m-d'),
509
                'stando' => $toDate->format('Y-m-d'),
510
            ],
511
            false);
512
        $sPath   = sprintf('%s/%s.zip', sys_get_temp_dir(), $res->nazwa_pliku);
513
        $content = base64_decode($res->plik_zawartosc);
514
515
        return Helper::saveFile($sPath, $content);
516
    }
517
518
    /**
519
     * Zwraca listę rodzajów jednostek
520
     *
521
     * @return string[]
522
     */
523
    public function PobierzSlownikRodzajowJednostek()
524
    {
525
        $res = $this->oClient->request('PobierzSlownikRodzajowJednostek');
526
527
        return Helper::getPropertyAsArray($res, 'string');
528
    }
529
530
    /**
531
     * Zwraca listę rodzajów miejscowości
532
     *
533
     * @return RodzajMiejscowosci[]
534
     */
535 1
    public function PobierzSlownikRodzajowSIMC()
536
    {
537 1
        $answer = [];
538 1
        $res    = $this->oClient->request('PobierzSlownikRodzajowSIMC');
539 1
        foreach (Helper::getPropertyAsArray($res, 'RodzajMiejscowosci') as $p) {
540 1
            $answer[] = new RodzajMiejscowosci($p);
541
        };
542
543 1
        return $answer;
544
    }
545
546
    /**
547
     * Zwraca listę cech obiektów z katalogu ulic
548
     *
549
     * @return string[]
550
     */
551 1
    public function PobierzSlownikCechULIC()
552
    {
553 1
        $res = $this->oClient->request('PobierzSlownikCechULIC');
554
555 1
        return Helper::getPropertyAsArray($res, 'string');
556
    }
557
558
    /**
559
     * Lista regionów
560
     *
561
     * @return JednostkaNomenklaturyNTS[]
562
     */
563 1
    public function PobierzListeRegionow()
564
    {
565 1
        $answer = [];
566 1
        $res    = $this->oClient->request('PobierzListeRegionow');
567 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaNomenklaturyNTS') as $p) {
568 1
            $answer[] = new JednostkaNomenklaturyNTS($p);
569
        };
570
571 1
        return $answer;
572
    }
573
574
    /**
575
     * Lista województw regionie
576
     *
577
     * @param string $regionId Jednoznakowy symbol regionu
578
     *
579
     * @return JednostkaNomenklaturyNTS[]
580
     */
581 1
    public function PobierzListeWojewodztwWRegionie(string $regionId)
582
    {
583 1
        $answer = [];
584 1
        $res    = $this->oClient->request('PobierzListeWojewodztwWRegionie', ['Reg' => $regionId]);
585 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaNomenklaturyNTS') as $p) {
586 1
            $answer[] = new JednostkaNomenklaturyNTS($p);
587
        };
588
589 1
        return $answer;
590
    }
591
592
    /**
593
     * Lista podregionów w województwie
594
     *
595
     * @param string $provinceId Dwuznakowy symbol województwa
596
     *
597
     * @return JednostkaNomenklaturyNTS[]
598
     */
599 1
    public function PobierzListePodregionow(string $provinceId)
600
    {
601 1
        $answer = [];
602 1
        $res    = $this->oClient->request('PobierzListePodregionow', ['Woj' => $provinceId]);
603 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaNomenklaturyNTS') as $p) {
604 1
            $answer[] = new JednostkaNomenklaturyNTS($p);
605
        };
606
607 1
        return $answer;
608
    }
609
610
    /**
611
     * Lista powiatów w podregionie
612
     *
613
     * @param string $subregionId Dwuznakowy symbol podregionu
614
     *
615
     * @return JednostkaNomenklaturyNTS[]
616
     */
617 1
    public function PobierzListePowiatowWPodregionie(string $subregionId)
618
    {
619 1
        $answer = [];
620 1
        $res    = $this->oClient->request('PobierzListePowiatowWPodregionie', ['Podreg' => $subregionId]);
621 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaNomenklaturyNTS') as $p) {
622 1
            $answer[] = new JednostkaNomenklaturyNTS($p);
623
        };
624
625 1
        return $answer;
626
    }
627
628
    /**
629
     * Lista gmin w powiecie
630
     *
631
     * @param string $districtId  dwuznakowy symbol powiatu
632
     * @param string $subregionId dwuznakowy symbol podregionu
633
     *
634
     * @return JednostkaNomenklaturyNTS[]
635
     */
636 1
    public function PobierzListeGminPowiecie(string $districtId, string $subregionId)
637
    {
638 1
        $answer = [];
639 1
        $res    = $this->oClient->request('PobierzListeGminPowiecie', ['Pow' => $districtId, 'Podreg' => $subregionId]);
640 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaNomenklaturyNTS') as $p) {
641 1
            $answer[] = new JednostkaNomenklaturyNTS($p);
642
        };
643
644 1
        return $answer;
645
    }
646
647
    /**
648
     * Zwraca listę znalezionych jednostek w katalagu TERC
649
     *
650
     * @param string $name
651
     *
652
     * @return JednostkaPodzialuTerytorialnego[]
653
     * @todo Metoda zwraca 0 wyników
654
     */
655 View Code Duplication
    public function WyszukajJPT(string $name)
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...
656
    {
657
        $answer = [];
658
        $res    = $this->oClient->request('WyszukajJPT', ['nazwa' => $name], false);
659
        foreach (Helper::getPropertyAsArray($res, 'JednostkaPodzialuTerytorialnego') as $p) {
660
            $answer[] = new JednostkaPodzialuTerytorialnego($p);
661
        };
662
663
        return $answer;
664
    }
665
666
    /**
667
     * Zwaraca listę znalezionych miejscowości w katalogu SIMC.
668
     *
669
     * @param string|null $cityName
670
     * @param string|null $cityId
671
     *
672
     * @return Miejscowosc[]
673
     */
674 View Code Duplication
    public function WyszukajMiejscowosc(string $cityName = null, string $cityId = null)
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...
675
    {
676
        $answer = [];
677
        $res    = $this->oClient->request('WyszukajMiejscowosc', ['nazwaMiejscowosci' => $cityName, 'identyfikatorMiejscowosci' => $cityId]);
678
        foreach (Helper::getPropertyAsArray($res, 'Miejscowosc') as $p) {
679
            $answer[] = new Miejscowosc($p);
680
        };
681
682
        return $answer;
683
    }
684
685
    /**
686
     * Zwaraca listę znalezionych miejscowości we wskazanej
687
     * jednostce podziału terytorialnego
688
     *
689
     * @param string $provinceName
690
     * @param string $districtName
691
     * @param string $communeName
692
     * @param string $cityName
693
     * @param string $cityId
694
     *
695
     * @return Miejscowosc[]
696
     */
697 View Code Duplication
    public function WyszukajMiejscowoscWJPT(
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...
698
        string $provinceName,
699
        string $districtName,
700
        string $communeName,
701
        string $cityName,
702
        string $cityId = null
703
    ) {
704
        $answer = [];
705
        /**
706
         * @var \stdClass|null $res
707
         */
708
        $res = $this->oClient->request('WyszukajMiejscowoscWJPT',
709
            [
710
                'nazwaWoj'                  => $provinceName,
711
                'nazwaPow'                  => $districtName,
712
                'nazwaGmi'                  => $communeName,
713
                'nazwaMiejscowosci'         => $cityName,
714
                'identyfikatorMiejscowosci' => $cityId,
715
            ]);
716
        foreach (Helper::getPropertyAsArray($res, 'Miejscowosc') as $p) {
717
            $answer[] = new Miejscowosc($p);
718
        };
719
720
        return $answer;
721
    }
722
723
    /**
724
     * Wyszukuje wskazaną ulicę w katalogu ULIC. Wyszukiwanie
725
     * odbywa się za pomoca nazw
726
     *
727
     * @param string|null $streetName
728
     * @param string|null $streetIdentityName
729
     * @param string|null $cityName
730
     *
731
     * @return Ulica[]
732
     */
733 View Code Duplication
    public function WyszukajUlice(string $streetName = null, string $streetIdentityName = null, string $cityName = null)
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...
734
    {
735
        $answer = [];
736
        $res    = $this->oClient->request('WyszukajUlice',
737
            [
738
                'nazwaulicy'        => $streetName,
739
                'cecha'             => $streetIdentityName,
740
                'nazwamiejscowosci' => $cityName,
741
            ]);
742
        foreach (Helper::getPropertyAsArray($res, 'Ulica') as $p) {
743
            $answer[] = new Ulica($p);
744
        };
745
746
        return $answer;
747
    }
748
749
    /**
750
     * Zwraca listę znalezionych jednostek w katalagu TERC
751
     *
752
     * @param string|null $name     zawiera nazwę wyszukiwanej jednostki
753
     * @param string|null $category określa kategorię wyszukiwanych jednostek
754
     * @param string[]    $tSimc    lista identyfikatorów SIMC (cityId)
755
     * @param string[]    $tTerc    lista identyfikatorów TERC (tercId)
756
     *
757
     * @return JednostkaPodzialuTerytorialnego[]
758
     */
759 1 View Code Duplication
    public function WyszukajJednostkeWRejestrze(
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...
760
        string $name = null,
761
        string $category = null,
762
        array $tSimc = [],
763
        array $tTerc = []
764
    ) {
765 1
        $answer     = [];
766 1
        $identyfiks = [];
767 1
        foreach ($tSimc as $simc) {
768
            $identyfiks[] = ['simc' => $simc];
769
        }
770 1
        foreach ($tTerc as $terc) {
771 1
            $identyfiks[] = ['terc' => $terc];
772
        }
773 1
        $res = $this->oClient->request('WyszukajJednostkeWRejestrze',
774
            [
775 1
                'nazwa'      => $name,
776 1
                'kategoria'  => $category ?? NativeApi::CATEGORY_ALL,
777 1
                'identyfiks' => $identyfiks,
778
            ]);
779 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaPodzialuTerytorialnego') as $p) {
780 1
            $answer[] = new JednostkaPodzialuTerytorialnego($p);
781
        };
782
783 1
        return $answer;
784
    }
785
786
    /**
787
     * Zwaraca listę znalezionych miejscowości we wskazanej
788
     * jednostcepodziału terytorialnego
789
     *
790
     * @param string|null $name         Nazwa miejscowości
791
     * @param string|null $cityId       ID miejscowości
792
     * @param array       $tSimc        Lista cityId w których szukamy
793
     * @param array       $tTerc        Lista tercId w których szukamy
794
     * @param string      $cityTypeName Predefinowany typ wyszukiwania ('000','001','002')
795
     *
796
     * @return WyszukanaMiejscowosc[]
797
     */
798 2 View Code Duplication
    public function WyszukajMiejscowoscWRejestrze(
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...
799
        string $name = null,
800
        string $cityId = null,
801
        array $tSimc = [],
802
        array $tTerc = [],
803
        string $cityTypeName = NativeApi::SEARCH_CITY_TYPE_ALL
804
    ) {
805 2
        $answer     = [];
806 2
        $identyfiks = [];
807 2
        foreach ($tSimc as $simc) {
808
            $identyfiks[] = ['simc' => $simc];
809
        }
810 2
        foreach ($tTerc as $terc) {
811
            $identyfiks[] = ['terc' => $terc];
812
        }
813 2
        $res = $this->oClient->request('WyszukajMiejscowoscWRejestrze',
814
            [
815 2
                'nazwa'              => $name,
816 2
                'rodzajMiejscowosci' => $cityTypeName,
817 2
                'symbol'             => $cityId,
818 2
                'identyfiks'         => $identyfiks,
819
            ]);
820 2
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaMiejscowosc') as $p) {
821 1
            $answer[] = new WyszukanaMiejscowosc($p);
822
        };
823
824 1
        return $answer;
825
    }
826
827
    /**
828
     * Wyszukuje wskazaną ulicę w katalogu ULIC
829
     *
830
     * @param string|null $name         Nazwa ulicy
831
     * @param string      $identityName Nazwa cechy, wymagane
832
     * @param string|null $streetId     ID ulicy
833
     * @param array       $tSimc        Lista cityId w których szukamy
834
     * @param array       $tTerc        Lista tercId w których szukamy
835
     *
836
     * @return WyszukanaUlica[]
837
     */
838 View Code Duplication
    public function WyszukajUliceWRejestrze(
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...
839
        string $name = null,
840
        string $identityName = 'ul.',
841
        string $streetId = null,
842
        array $tSimc = [],
843
        array $tTerc = []
844
    ) {
845
        $answer     = [];
846
        $identyfiks = [];
847
        foreach ($tSimc as $simc) {
848
            $identyfiks[] = ['simc' => $simc];
849
        }
850
        foreach ($tTerc as $terc) {
851
            $identyfiks[] = ['terc' => $terc];
852
        }
853
        $res = $this->oClient->request('WyszukajUliceWRejestrze',
854
            [
855
                'nazwa'         => $name,
856
                'cecha'         => $identityName,
857
                'identyfikator' => $streetId,
858
                'identyfiks'    => $identyfiks,
859
            ]);
860
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaUlica') as $p) {
861
            $answer[] = new WyszukanaUlica($p);
862
        };
863
864
        return $answer;
865
    }
866
867
    /**
868
     * Lista miejscowości znajdujących się we wskazanej gminie.
869
     * Wyszukiwanie odbywa się z uwzględnieniem nazw
870
     *
871
     * @param string $provinceName
872
     * @param string $districtName
873
     * @param string $communeName
874
     *
875
     * @return Miejscowosc[]
876
     * @todo Metoda nie działa
877
     */
878
    public function PobierzListeMiejscowosciWGminie(string $provinceName, string $districtName, string $communeName)
879
    {
880
        $answer = [];
881
        $res    = $this->oClient->request('PobierzListeMiejscowosciWGminie',
882
            [
883
                'Wojewodztwo' => $provinceName,
884
                'Powiat'      => $districtName,
885
                'Gmina'       => $communeName,
886
            ]);
887
        foreach (Helper::getPropertyAsArray($res, 'Miejscowosc') as $p) {
888
            $answer[] = new Miejscowosc($p);
889
        };
890
891
        return $answer;
892
    }
893
894
    /**
895
     * Lista miejscowości znajdujących się we wskazanej gminie.
896
     * Wyszukiwanie odbywa się z uwzględnieniem symboli
897
     *
898
     * @param int $tercId
899
     *
900
     * @return Miejscowosc[]
901
     * @todo Zwraca niezgodne typy - połatane
902
     */
903
    public function PobierzListeMiejscowosciWRodzajuGminy(int $tercId)
904
    {
905
        $answer = [];
906
        $oTerc  = new Terc($tercId);
907
        $res    = $this->oClient->request('PobierzListeMiejscowosciWRodzajuGminy',
908
            [
909
                'symbolWoj'  => $oTerc->getProvinceId(),
910
                'symbolPow'  => $oTerc->getDistrictId(),
911
                'symbolGmi'  => $oTerc->getCommuneId(),
912
                'symbolRodz' => $oTerc->getCommuneTypeId(),
913
            ]);
914
        foreach (Helper::getPropertyAsArray($res, 'Miejscowosc') as $p) {
915
            $answer[] = new Miejscowosc($p);
916
        };
917
918
        return $answer;
919
    }
920
921
    /**
922
     * Lista województw
923
     *
924
     * @return JednostkaTerytorialna[]
925
     */
926 4
    public function PobierzListeWojewodztw()
927
    {
928 4
        $answer = [];
929 4
        $res    = $this->oClient->request('PobierzListeWojewodztw');
930 3
        foreach (Helper::getPropertyAsArray($res, 'JednostkaTerytorialna') as $p) {
931 3
            $answer[] = new JednostkaTerytorialna($p);
932
        };
933
934 3
        return $answer;
935
    }
936
937
    /**
938
     * Pobieranie listy powiatów dla danego województwa
939
     *
940
     * @param string $provinceId
941
     *
942
     * @return JednostkaTerytorialna[]
943
     */
944 2
    public function PobierzListePowiatow(string $provinceId)
945
    {
946 2
        $answer = [];
947 2
        $res    = $this->oClient->request('PobierzListePowiatow', ['Woj' => $provinceId]);
948 2
        foreach (Helper::getPropertyAsArray($res, 'JednostkaTerytorialna') as $p) {
949 2
            $answer[] = new JednostkaTerytorialna($p);
950
        };
951
952 2
        return $answer;
953
    }
954
955
    /**
956
     * Lista gmin we wskazanym powiecie
957
     *
958
     * @param string $provinceId
959
     * @param string $districtId
960
     *
961
     * @return JednostkaTerytorialna[]
962
     */
963 1
    public function PobierzListeGmin(string $provinceId, string $districtId)
964
    {
965 1
        $answer = [];
966 1
        $res    = $this->oClient->request('PobierzListeGmin', ['Woj' => $provinceId, 'Pow' => $districtId]);
967 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaTerytorialna') as $p) {
968 1
            $answer[] = new JednostkaTerytorialna($p);
969
        };
970
971 1
        return $answer;
972
    }
973
974
    /**
975
     * Lista powiatów i gmin we wskazanym województwie
976
     *
977
     * @param string $provinceId
978
     *
979
     * @return JednostkaTerytorialna[]
980
     */
981 1
    public function PobierzGminyiPowDlaWoj(string $provinceId)
982
    {
983 1
        $answer = [];
984 1
        $res    = $this->oClient->request('PobierzGminyiPowDlaWoj', ['Woj' => $provinceId]);
985 1
        foreach (Helper::getPropertyAsArray($res, 'JednostkaTerytorialna') as $p) {
986 1
            $answer[] = new JednostkaTerytorialna($p);
987
        };
988
989 1
        return $answer;
990
    }
991
992
    /**
993
     * Lista ulic we wskazanej miejscowości
994
     *
995
     * @param int    $tercId
996
     * @param string $cityId
997
     * @param bool   $asAddress
998
     *
999
     * @return UlicaDrzewo[]
1000
     */
1001
    public function PobierzListeUlicDlaMiejscowosci(int $tercId, string $cityId, bool $asAddress = false)
1002
    {
1003
        $answer = [];
1004
        $oTerc  = new Terc($tercId);
1005
        $res    = $this->oClient->request('PobierzListeUlicDlaMiejscowosci',
1006
            [
1007
                'woj'               => $oTerc->getProvinceId(),
1008
                'pow'               => $oTerc->getDistrictId(),
1009
                'gmi'               => $oTerc->getCommuneId(),
1010
                'rodzaj'            => $oTerc->getCommuneTypeId(),
1011
                'msc'               => $cityId,
1012
                'czyWersjaUrzedowa' => !$asAddress,
1013
                'czyWersjaAdresowa' => $asAddress,
1014
            ]
1015
        );
1016
        foreach (Helper::getPropertyAsArray($res, 'UlicaDrzewo') as $p) {
1017
            $answer[] = new UlicaDrzewo($p);
1018
        };
1019
1020
        return $answer;
1021
    }
1022
1023
    /**
1024
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu
1025
     * miejscowości. Weryfikacja odbywa się za pomoca identyfikatorów
1026
     *
1027
     * @param string $cityId
1028
     *
1029
     * @return ZweryfikowanyAdresBezUlic
1030
     */
1031 1 View Code Duplication
    public 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...
1032
    {
1033 1
        $res   = $this->oClient->request('WeryfikujAdresDlaMiejscowosci', ['symbolMsc' => $cityId]);
1034 1
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdresBezUlic');
1035
1036 1
        return new ZweryfikowanyAdresBezUlic($oData);
1037
    }
1038
1039
    /**
1040
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT,w wersji
1041
     * adresowej rejestru do poziomu miejscowości. Weryfikacja odbywa się za pomoca identyfikatorów
1042
     *
1043
     * @param string $cityId
1044
     *
1045
     * @return ZweryfikowanyAdresBezUlic
1046
     */
1047 1 View Code Duplication
    public 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...
1048
    {
1049 1
        $res   = $this->oClient->request('WeryfikujAdresDlaMiejscowosciAdresowy', ['symbolMsc' => $cityId]);
1050 1
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdresBezUlic');
1051
1052 1
        return new ZweryfikowanyAdresBezUlic($oData);
1053
    }
1054
1055
    /**
1056
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu
1057
     * miejscowości. Weryfikacja odbywa się za pomoca nazw
1058
     *
1059
     * Nazwa miejscowości nie musibyć pełna - nastąpi wtedy wyszkiwanie pełnokontekstowe
1060
     * w wtórym zostanie zwrócona tablica wyników
1061
     *
1062
     * @param string      $provinceName Nazwa województwa
1063
     * @param string      $districtName Nazwa powiatu
1064
     * @param string      $communeName  Nazwa gminy
1065
     * @param string      $cityName     Nazwa miejscowości
1066
     * @param string|null $cityTypeName Nazwa typu miejscowości
1067
     *
1068
     * @return ZweryfikowanyAdresBezUlic[]
1069
     */
1070 1 View Code Duplication
    public 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...
1071
        string $provinceName,
1072
        string $districtName,
1073
        string $communeName,
1074
        string $cityName,
1075
        string $cityTypeName = null
1076
    ) {
1077 1
        $answer = [];
1078 1
        $res    = $this->oClient->request('WeryfikujAdresWmiejscowosci',
1079
            [
1080 1
                'Wojewodztwo' => $provinceName,
1081 1
                'Powiat'      => $districtName,
1082 1
                'Gmina'       => $communeName,
1083 1
                'Miejscowosc' => $cityName,
1084 1
                'Rodzaj'      => $cityTypeName,
1085
            ]);
1086 1
        foreach (Helper::getPropertyAsArray($res, 'ZweryfikowanyAdresBezUlic') as $p) {
1087 1
            $answer[] = new ZweryfikowanyAdresBezUlic($p);
1088
        };
1089
1090 1
        return $answer;
1091
    }
1092
1093
    /**
1094
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT w wersji adresowej do poziomu
1095
     * miejscowości. Weryfikacja odbywa się za pomoca nazw
1096
     *
1097
     * Nazwa miejscowości nie musibyć pełna - nastąpi wtedy wyszkiwanie pełnokontekstowe
1098
     * w wtórym zostanie zwrócona tablica wyników
1099
     *
1100
     * @param string      $provinceName Nazwa województwa
1101
     * @param string      $districtName Nazwa powiatu
1102
     * @param string      $communeName  Nazwa gminy
1103
     * @param string      $cityName     Nazwa miejscowości
1104
     * @param string|null $cityTypeName Nazwa typu miejscowości
1105
     *
1106
     * @return ZweryfikowanyAdresBezUlic[]
1107
     */
1108 1 View Code Duplication
    public 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...
1109
        string $provinceName,
1110
        string $districtName,
1111
        string $communeName,
1112
        string $cityName,
1113
        string $cityTypeName = null
1114
    ) {
1115 1
        $answer = [];
1116 1
        $res    = $this->oClient->request('WeryfikujAdresWmiejscowosciAdresowy',
1117
            [
1118 1
                'Wojewodztwo' => $provinceName,
1119 1
                'Powiat'      => $districtName,
1120 1
                'Gmina'       => $communeName,
1121 1
                'Miejscowosc' => $cityName,
1122 1
                'Rodzaj'      => $cityTypeName,
1123
            ]);
1124 1
        foreach (Helper::getPropertyAsArray($res, 'ZweryfikowanyAdresBezUlic') as $p) {
1125 1
            $answer[] = new ZweryfikowanyAdresBezUlic($p);
1126
        };
1127
1128 1
        return $answer;
1129
    }
1130
1131
    /**
1132
     * Weryfikuje istnienie wskazanego obiektu w bazie
1133
     * TERYT do poziomu ulic.Weryfikacja odbywa się za pomoca nazw
1134
     *
1135
     * @param string $cityId
1136
     * @param string $streetId
1137
     *
1138
     * @return ZweryfikowanyAdres
1139
     */
1140 1 View Code Duplication
    public 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...
1141
    {
1142 1
        $res   = $this->oClient->request('WeryfikujAdresDlaUlic', ['symbolMsc' => $cityId, 'SymUl' => $streetId]);
1143 1
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdres');
1144
1145 1
        return new ZweryfikowanyAdres($oData);
1146
    }
1147
1148
    /**
1149
     * Weryfikuje istnienie wskazanego obiektu w bazie
1150
     * TERYT do poziomu ulic w wersji adresowej. Weryfikacja odbywa się za pomoca nazw
1151
     *
1152
     * @param string $cityId
1153
     * @param string $streetId
1154
     *
1155
     * @return ZweryfikowanyAdres
1156
     */
1157 1 View Code Duplication
    public 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...
1158
    {
1159 1
        $res   = $this->oClient->request('WeryfikujAdresDlaUlicAdresowy', ['symbolMsc' => $cityId, 'SymUl' => $streetId]);
1160 1
        $oData = Helper::getPropertyAsObject($res, 'ZweryfikowanyAdres');
1161
1162 1
        return new ZweryfikowanyAdres($oData);
1163
    }
1164
1165
    /**
1166
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu ulic.
1167
     * Weryfikacja odbywa się za pomoca nazw
1168
     *
1169
     * @param string      $provinceName
1170
     * @param string      $districtName
1171
     * @param string      $communeName
1172
     * @param string      $cityName
1173
     * @param string|null $cityTypeName
1174
     * @param string      $streetName
1175
     *
1176
     * @return ZweryfikowanyAdres[]
1177
     */
1178 View Code Duplication
    public 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...
1179
        string $provinceName,
1180
        string $districtName,
1181
        string $communeName,
1182
        string $cityName,
1183
        string $cityTypeName = null,
1184
        string $streetName
1185
    ) {
1186
        $answer = [];
1187
        $res    = $this->oClient->request('WeryfikujNazwaAdresUlic',
1188
            [
1189
                'nazwaWoj'         => $provinceName,
1190
                'nazwaPow'         => $districtName,
1191
                'nazwaGmi'         => $communeName,
1192
                'nazwaMiejscowosc' => $cityName,
1193
                'rodzajMiejsc'     => $cityTypeName,
1194
                'nazwaUlicy'       => $streetName,
1195
            ]);
1196
1197
        $tData = Helper::getPropertyAsArray($res, 'ZweryfikowanyAdres');
1198
1199
        foreach ($tData as $datum) {
1200
            $answer[] = new ZweryfikowanyAdres($datum);
1201
        }
1202
1203
        return $answer;
1204
    }
1205
1206
    /**
1207
     * Weryfikuje istnienie wskazanego obiektu w bazie TERYT do poziomu ulic w wersji adresowej rejestru.
1208
     * Weryfikacja odbywa się za pomoca nazw
1209
     *
1210
     * @param string      $provinceName
1211
     * @param string      $districtName
1212
     * @param string      $communeName
1213
     * @param string      $cityName
1214
     * @param string|null $cityTypeName
1215
     * @param string      $streetName
1216
     *
1217
     * @return ZweryfikowanyAdres[]
1218
     */
1219 View Code Duplication
    public 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...
1220
        string $provinceName,
1221
        string $districtName,
1222
        string $communeName,
1223
        string $cityName,
1224
        string $cityTypeName = null,
1225
        string $streetName
1226
    ) {
1227
        $answer = [];
1228
        $res    = $this->oClient->request('WeryfikujNazwaAdresUlicAdresowy',
1229
            [
1230
                'nazwaWoj'         => $provinceName,
1231
                'nazwaPow'         => $districtName,
1232
                'nazwaGmi'         => $communeName,
1233
                'nazwaMiejscowosc' => $cityName,
1234
                'rodzajMiejsc'     => $cityTypeName,
1235
                'nazwaUlicy'       => $streetName,
1236
            ]);
1237
1238
        $tData = Helper::getPropertyAsArray($res, 'ZweryfikowanyAdres');
1239
1240
        foreach ($tData as $datum) {
1241
            $answer[] = new ZweryfikowanyAdres($datum);
1242
        }
1243
1244
        return $answer;
1245
    }
1246
}
1247