@@ -82,14 +82,7 @@ public function geocodeQuery(GeocodeQuery $query) : self
82
82
"geocoder- {$ cacheKey }" ,
83
83
config ('geocoder.cache-duraction ' , 0 ),
84
84
function () use ($ query ) {
85
- $ addresses = collect ();
86
- $ addressCollection = $ this ->aggregator ->geocodeQuery ($ query );
87
-
88
- foreach ($ addressCollection as $ address ) {
89
- $ addresses ->push ($ address );
90
- }
91
-
92
- return $ addresses ;
85
+ return collect ($ this ->aggregator ->geocodeQuery ($ query ));
93
86
}
94
87
);
95
88
@@ -103,14 +96,7 @@ public function reverseQuery(ReverseQuery $query) : self
103
96
"geocoder- {$ cacheKey }" ,
104
97
config ('geocoder.cache-duraction ' , 0 ),
105
98
function () use ($ query ) {
106
- $ addresses = collect ();
107
- $ addressCollection = $ this ->aggregator ->reverseQuery ($ query );
108
-
109
- foreach ($ addressCollection as $ address ) {
110
- $ addresses ->push ($ address );
111
- }
112
-
113
- return $ addresses ;
99
+ return collect ($ this ->aggregator ->reverseQuery ($ query ));
114
100
}
115
101
);
116
102
@@ -129,15 +115,7 @@ public function geocode(string $value) : self
129
115
"geocoder- {$ cacheKey }" ,
130
116
config ('geocoder.cache-duraction ' , 0 ),
131
117
function () use ($ value ) {
132
-
133
- $ addresses = collect ();
134
- $ addressCollection = $ this ->aggregator ->geocode ($ value );
135
-
136
- foreach ($ addressCollection as $ address ) {
137
- $ addresses ->push ($ address );
138
- }
139
-
140
- return $ addresses ;
118
+ return collect ($ this ->aggregator ->geocode ($ value ));
141
119
}
142
120
);
143
121
@@ -151,14 +129,7 @@ public function reverse(float $latitude, float $longitude) : self
151
129
"geocoder- {$ cacheId }" ,
152
130
config ('geocoder.cache-duraction ' , 0 ),
153
131
function () use ($ latitude , $ longitude ) {
154
- $ addresses = collect ();
155
- $ addressCollection = $ this ->aggregator ->reverse ($ latitude , $ longitude );
156
-
157
- foreach ($ addressCollection as $ address ) {
158
- $ addresses ->push ($ address );
159
- }
160
-
161
- return $ addresses ;
132
+ return collect ($ this ->aggregator ->reverse ($ latitude , $ longitude ));
162
133
}
163
134
);
164
135
@@ -177,7 +148,7 @@ public function getLimit() : int
177
148
return $ this ->aggregator ->getLimit ();
178
149
}
179
150
180
- public function registerProvider (string $ provider ) : self
151
+ public function registerProvider ($ provider ) : self
181
152
{
182
153
$ this ->aggregator ->registerProvider ($ provider );
183
154
0 commit comments