Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2cd8813

Browse files
committed
ChangedgetProvider() method to no longer be deprecated, and instead return the currently set provider, or if none set, the first configured provider.
1 parent41f22b3 commit2cd8813

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to[Semantic Versioning](http://semver.org/).
44

5+
##[4.3.4] - 2020-06-21
6+
###Fixed
7+
- non-caching declaration to only apply to current query.
8+
9+
###Changed
10+
-`getProvider()` method to no longer be deprecated, and instead return the
11+
currently set provider, or if none set, the first configured provider.
12+
513
##[4.3.3] - 2020-06-20
614
###Added
715
- functionality to not cache requests by using`doNotCache()`.

‎src/ProviderAndDumperAggregator.php‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ public function limit(int $limit) : self
130130
return$this;
131131
}
132132

133-
/**
134-
* @deprecated Use `getProviders()` instead.
135-
*/
136133
publicfunctiongetProvider()
137134
{
138-
return$this->getProviders()->first();
135+
$reflectedClass =newReflectionClass(ProviderAggregator::class);
136+
$reflectedProperty =$reflectedClass->getProperty('provider');
137+
$reflectedProperty->setAccessible(true);
138+
139+
return$reflectedProperty->getValue($this->aggregator)
140+
??$this->getProviders()->first();
139141
}
140142

141143
publicfunctiongetProviders() :Collection
@@ -190,6 +192,8 @@ public function using(string $name) : self
190192
protectedfunctioncacheRequest(string$cacheKey,array$queryElements,string$queryType)
191193
{
192194
if (!$this->isCaching) {
195+
$this->isCaching =true;
196+
193197
returncollect($this->aggregator->{$queryType}(...$queryElements));
194198
}
195199

‎tests/Feature/Providers/GeocoderServiceTest.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,13 @@ public function testCachingCanBeDisabled()
326326
$results->first()->getFormattedAddress()
327327
);
328328
}
329+
330+
publicfunctiontestGetProviderReturnsCurrentProvider()
331+
{
332+
$provider =app("geocoder")
333+
->using("google_maps")
334+
->getProvider();
335+
336+
$this->assertEquals("google_maps",$provider->getName());
337+
}
329338
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp