Code Duplication    Length = 26-28 lines in 3 locations

src/mrcnpdlk/Teryt/NativeApi.php 3 locations

@@ 755-780 (lines=26) @@
752
     *
753
     * @return JednostkaPodzialuTerytorialnego[]
754
     */
755
    public function WyszukajJednostkeWRejestrze(
756
        string $name = null,
757
        string $category = null,
758
        array $tSimc = [],
759
        array $tTerc = []
760
    ) {
761
        $answer     = [];
762
        $identyfiks = [];
763
        foreach ($tSimc as $simc) {
764
            $identyfiks[] = ['simc' => $simc];
765
        }
766
        foreach ($tTerc as $terc) {
767
            $identyfiks[] = ['terc' => $terc];
768
        }
769
        $res = $this->oClient->request('WyszukajJednostkeWRejestrze',
770
            [
771
                'nazwa'      => $name,
772
                'kategoria'  => $category ?? NativeApi::CATEGORY_ALL,
773
                'identyfiks' => $identyfiks,
774
            ]);
775
        foreach (Helper::getPropertyAsArray($res, 'JednostkaPodzialuTerytorialnego') as $p) {
776
            $answer[] = new JednostkaPodzialuTerytorialnego($p);
777
        };
778
779
        return $answer;
780
    }
781
782
    /**
783
     * Zwaraca listę znalezionych miejscowości we wskazanej
@@ 794-821 (lines=28) @@
791
     *
792
     * @return WyszukanaMiejscowosc[]
793
     */
794
    public function WyszukajMiejscowoscWRejestrze(
795
        string $name = null,
796
        string $cityId = null,
797
        array $tSimc = [],
798
        array $tTerc = [],
799
        string $cityTypeName = NativeApi::SEARCH_CITY_TYPE_ALL
800
    ) {
801
        $answer     = [];
802
        $identyfiks = [];
803
        foreach ($tSimc as $simc) {
804
            $identyfiks[] = ['simc' => $simc];
805
        }
806
        foreach ($tTerc as $terc) {
807
            $identyfiks[] = ['terc' => $terc];
808
        }
809
        $res = $this->oClient->request('WyszukajMiejscowoscWRejestrze',
810
            [
811
                'nazwa'              => $name,
812
                'rodzajMiejscowosci' => $cityTypeName,
813
                'symbol'             => $cityId,
814
                'identyfiks'         => $identyfiks,
815
            ]);
816
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaMiejscowosc') as $p) {
817
            $answer[] = new WyszukanaMiejscowosc($p);
818
        };
819
820
        return $answer;
821
    }
822
823
    /**
824
     * Wyszukuje wskazaną ulicę w katalogu ULIC
@@ 834-861 (lines=28) @@
831
     *
832
     * @return WyszukanaUlica[]
833
     */
834
    public function WyszukajUliceWRejestrze(
835
        string $name = null,
836
        string $identityName = 'ul.',
837
        string $streetId = null,
838
        array $tSimc = [],
839
        array $tTerc = []
840
    ) {
841
        $answer     = [];
842
        $identyfiks = [];
843
        foreach ($tSimc as $simc) {
844
            $identyfiks[] = ['simc' => $simc];
845
        }
846
        foreach ($tTerc as $terc) {
847
            $identyfiks[] = ['terc' => $terc];
848
        }
849
        $res = $this->oClient->request('WyszukajUliceWRejestrze',
850
            [
851
                'nazwa'         => $name,
852
                'cecha'         => $identityName,
853
                'identyfikator' => $streetId,
854
                'identyfiks'    => $identyfiks,
855
            ]);
856
        foreach (Helper::getPropertyAsArray($res, 'WyszukanaUlica') as $p) {
857
            $answer[] = new WyszukanaUlica($p);
858
        };
859
860
        return $answer;
861
    }
862
863
    /**
864
     * Lista miejscowości znajdujących się we wskazanej gminie.