Code Duplication    Length = 26-28 lines in 3 locations

src/mrcnpdlk/Teryt/NativeApi.php 3 locations

@@ 759-784 (lines=26) @@
756
     *
757
     * @return JednostkaPodzialuTerytorialnego[]
758
     */
759
    public function WyszukajJednostkeWRejestrze(
760
        string $name = null,
761
        string $category = null,
762
        array $tSimc = [],
763
        array $tTerc = []
764
    ) {
765
        $answer     = [];
766
        $identyfiks = [];
767
        foreach ($tSimc as $simc) {
768
            $identyfiks[] = ['simc' => $simc];
769
        }
770
        foreach ($tTerc as $terc) {
771
            $identyfiks[] = ['terc' => $terc];
772
        }
773
        $res = $this->oClient->request('WyszukajJednostkeWRejestrze',
774
            [
775
                'nazwa'      => $name,
776
                'kategoria'  => $category ?? NativeApi::CATEGORY_ALL,
777
                'identyfiks' => $identyfiks,
778
            ]);
779
        foreach (Helper::getPropertyAsArray($res, 'JednostkaPodzialuTerytorialnego') as $p) {
780
            $answer[] = new JednostkaPodzialuTerytorialnego($p);
781
        };
782
783
        return $answer;
784
    }
785
786
    /**
787
     * Zwaraca listę znalezionych miejscowości we wskazanej
@@ 798-825 (lines=28) @@
795
     *
796
     * @return WyszukanaMiejscowosc[]
797
     */
798
    public function WyszukajMiejscowoscWRejestrze(
799
        string $name = null,
800
        string $cityId = null,
801
        array $tSimc = [],
802
        array $tTerc = [],
803
        string $cityTypeName = NativeApi::SEARCH_CITY_TYPE_ALL
804
    ) {
805
        $answer     = [];
806
        $identyfiks = [];
807
        foreach ($tSimc as $simc) {
808
            $identyfiks[] = ['simc' => $simc];
809
        }
810
        foreach ($tTerc as $terc) {
811
            $identyfiks[] = ['terc' => $terc];
812
        }
813
        $res = $this->oClient->request('WyszukajMiejscowoscWRejestrze',
814
            [
815
                'nazwa'              => $name,
816
                'rodzajMiejscowosci' => $cityTypeName,
817
                'symbol'             => $cityId,
818
                'identyfiks'         => $identyfiks,
819
            ]);
820
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaMiejscowosc') as $p) {
821
            $answer[] = new WyszukanaMiejscowosc($p);
822
        };
823
824
        return $answer;
825
    }
826
827
    /**
828
     * Wyszukuje wskazaną ulicę w katalogu ULIC
@@ 838-865 (lines=28) @@
835
     *
836
     * @return WyszukanaUlica[]
837
     */
838
    public function WyszukajUliceWRejestrze(
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.