Code Duplication    Length = 23-23 lines in 2 locations

app/models/GeoFixer.php 2 locations

@@ 87-109 (lines=23) @@
84
     *
85
     * @return bool|mixed
86
     */
87
    public function findFiasSettlements($city, $region_code)
88
    {
89
        $settlements = new SettlementsDatabaseQuery();
90
        $settlements = $settlements->getSettlements()->regionCode($region_code)->addressLevel();
91
92
        if (is_integer($this->first_letters)) {
93
            $settlements = $settlements->firstLetters(substr($city, 0, $this->first_letters));
94
        }
95
96
        $settlements = $settlements->findAll();
97
98
        $titles = [];
99
        $settlements_with_id = [];
100
101
        foreach ($settlements as $v) {
102
            $settlements_with_id[$v['title']] = $v['address_id'];
103
            $titles[] = $v['title'];
104
        }
105
106
        $result = $this->findSimilarWord($city, $titles);
107
108
        return $result ? $settlements_with_id[$result] : false;
109
    }
110
111
    /**
112
     * @param $city
@@ 154-176 (lines=23) @@
151
     *
152
     * @return bool|mixed
153
     */
154
    public function findFiasStreets($street, $city_id)
155
    {
156
        $streets = new StreetsDatabaseQuery();
157
        $streets = $streets->getStreets()->parentId($city_id)->addressLevel();
158
159
        if (is_integer($this->first_letters)) {
160
            $streets = $streets->firstLetters(substr($street, 0, $this->first_letters));
161
        }
162
163
        $streets = $streets->findAll();
164
165
        $titles = [];
166
        $streets_with_id = [];
167
168
        foreach ($streets as $v) {
169
            $streets_with_id[$v['title']] = $v['address_id'];
170
            $titles[] = $v['title'];
171
        }
172
173
        $result = $this->findSimilarWord($street, $titles);
174
175
        return $result ? $streets_with_id[$result] : false;
176
    }
177
178
    /**
179
     * @param $street