Code Duplication    Length = 26-28 lines in 3 locations

src/mrcnpdlk/Teryt/NativeApi.php 3 locations

@@ 1055-1080 (lines=26) @@
1052
     *
1053
     * @return JednostkaPodzialuTerytorialnego[]
1054
     */
1055
    public function WyszukajJednostkeWRejestrze(
1056
        string $name = null,
1057
        string $category = null,
1058
        array $tSimc = [],
1059
        array $tTerc = []
1060
    ) {
1061
        $answer     = [];
1062
        $identyfiks = [];
1063
        foreach ($tSimc as $simc) {
1064
            $identyfiks[] = ['simc' => $simc];
1065
        }
1066
        foreach ($tTerc as $terc) {
1067
            $identyfiks[] = ['terc' => $terc];
1068
        }
1069
        $res = $this->oClient->request('WyszukajJednostkeWRejestrze',
1070
            [
1071
                'nazwa'      => $name,
1072
                'kategoria'  => $category ?? NativeApi::CATEGORY_ALL,
1073
                'identyfiks' => $identyfiks,
1074
            ]);
1075
        foreach (Helper::getPropertyAsArray($res, 'JednostkaPodzialuTerytorialnego') as $p) {
1076
            $answer[] = new JednostkaPodzialuTerytorialnego($p);
1077
        };
1078
1079
        return $answer;
1080
    }
1081
1082
    /**
1083
     * Zwaraca listę znalezionych miejscowości w katalogu SIMC.
@@ 1151-1178 (lines=28) @@
1148
     *
1149
     * @return WyszukanaMiejscowosc[]
1150
     */
1151
    public function WyszukajMiejscowoscWRejestrze(
1152
        string $name = null,
1153
        string $cityId = null,
1154
        array $tSimc = [],
1155
        array $tTerc = [],
1156
        string $cityTypeName = NativeApi::SEARCH_CITY_TYPE_ALL
1157
    ) {
1158
        $answer     = [];
1159
        $identyfiks = [];
1160
        foreach ($tSimc as $simc) {
1161
            $identyfiks[] = ['simc' => $simc];
1162
        }
1163
        foreach ($tTerc as $terc) {
1164
            $identyfiks[] = ['terc' => $terc];
1165
        }
1166
        $res = $this->oClient->request('WyszukajMiejscowoscWRejestrze',
1167
            [
1168
                'nazwa'              => $name,
1169
                'rodzajMiejscowosci' => $cityTypeName,
1170
                'symbol'             => $cityId,
1171
                'identyfiks'         => $identyfiks,
1172
            ]);
1173
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaMiejscowosc') as $p) {
1174
            $answer[] = new WyszukanaMiejscowosc($p);
1175
        };
1176
1177
        return $answer;
1178
    }
1179
1180
    /**
1181
     * Wyszukuje wskazaną ulicę w katalogu ULIC. Wyszukiwanie odbywa się za pomoca nazw
@@ 1216-1243 (lines=28) @@
1213
     *
1214
     * @return WyszukanaUlica[]
1215
     */
1216
    public function WyszukajUliceWRejestrze(
1217
        string $name = null,
1218
        string $identityName = 'ul.',
1219
        string $streetId = null,
1220
        array $tSimc = [],
1221
        array $tTerc = []
1222
    ) {
1223
        $answer     = [];
1224
        $identyfiks = [];
1225
        foreach ($tSimc as $simc) {
1226
            $identyfiks[] = ['simc' => $simc];
1227
        }
1228
        foreach ($tTerc as $terc) {
1229
            $identyfiks[] = ['terc' => $terc];
1230
        }
1231
        $res = $this->oClient->request('WyszukajUliceWRejestrze',
1232
            [
1233
                'nazwa'         => $name,
1234
                'cecha'         => $identityName,
1235
                'identyfikator' => $streetId,
1236
                'identyfiks'    => $identyfiks,
1237
            ]);
1238
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaUlica') as $p) {
1239
            $answer[] = new WyszukanaUlica($p);
1240
        };
1241
1242
        return $answer;
1243
    }
1244
}
1245