@@ 49-63 (lines=15) @@ | ||
46 | * |
|
47 | * @return bool|mixed |
|
48 | */ |
|
49 | public function findFiasRegion($region) |
|
50 | { |
|
51 | $this->code_name = AbstractDatabaseQuery::KLADR_CODE; |
|
52 | ||
53 | $regions = new RegionsDatabaseQuery(); |
|
54 | $regions = $regions->getRegions(); |
|
55 | ||
56 | if (is_integer($this->first_letters)) { |
|
57 | $regions = $regions->firstLetters(substr($region, 0, $this->first_letters)); |
|
58 | } |
|
59 | ||
60 | $regions = $regions->findAll(); |
|
61 | ||
62 | return $this->getResult($regions, $region); |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * @param $word |
|
@@ 94-108 (lines=15) @@ | ||
91 | * |
|
92 | * @return bool|mixed |
|
93 | */ |
|
94 | public function findFiasSettlements($city, $region_code) |
|
95 | { |
|
96 | $this->code_name = AbstractDatabaseQuery::FIAS_CODE; |
|
97 | ||
98 | $settlements = new SettlementsDatabaseQuery(); |
|
99 | $settlements = $settlements->getSettlements()->regionCode($region_code)->addressLevel(); |
|
100 | ||
101 | if (is_integer($this->first_letters)) { |
|
102 | $settlements = $settlements->firstLetters(substr($city, 0, $this->first_letters)); |
|
103 | } |
|
104 | ||
105 | $settlements = $settlements->findAll(); |
|
106 | ||
107 | return $this->getResult($settlements, $city); |
|
108 | } |
|
109 | ||
110 | /** |
|
111 | * @param $city |
|
@@ 116-130 (lines=15) @@ | ||
113 | * |
|
114 | * @return bool|mixed |
|
115 | */ |
|
116 | public function findKladrSettlements($city, $region_code) |
|
117 | { |
|
118 | $this->code_name = AbstractDatabaseQuery::KLADR_CODE; |
|
119 | ||
120 | $settlements = new SettlementsDatabaseQuery(); |
|
121 | $settlements = $settlements->getSettlements()->regionCode($region_code)->addressLevel(); |
|
122 | ||
123 | if (is_integer($this->first_letters)) { |
|
124 | $settlements = $settlements->firstLetters(substr($city, 0, $this->first_letters)); |
|
125 | } |
|
126 | ||
127 | $settlements = $settlements->findAll(); |
|
128 | ||
129 | return $this->getResult($settlements, $city); |
|
130 | } |
|
131 | ||
132 | /** |
|
133 | * @param $street |
|
@@ 138-152 (lines=15) @@ | ||
135 | * |
|
136 | * @return bool|mixed |
|
137 | */ |
|
138 | public function findFiasStreets($street, $city_id) |
|
139 | { |
|
140 | $this->code_name = AbstractDatabaseQuery::FIAS_CODE; |
|
141 | ||
142 | $streets = new StreetsDatabaseQuery(); |
|
143 | $streets = $streets->getStreets()->parentId($city_id)->addressLevel(); |
|
144 | ||
145 | if (is_integer($this->first_letters)) { |
|
146 | $streets = $streets->firstLetters(substr($street, 0, $this->first_letters)); |
|
147 | } |
|
148 | ||
149 | $streets = $streets->findAll(); |
|
150 | ||
151 | return $this->getResult($streets, $street); |
|
152 | } |
|
153 | ||
154 | /** |
|
155 | * @param $street |