Skip to content

Commit 12ef93e

Browse files
committed
Add setMaxResults method
1 parent 94a4315 commit 12ef93e

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

src/Geocoder/Geocoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function setResultFactory(ResultFactoryInterface $resultFactory = null)
7676
*
7777
* @return GeocoderInterface
7878
*/
79-
public function setMaxResults($maxResults)
79+
public function limit($maxResults)
8080
{
8181
$this->maxResults = $maxResults;
8282

src/Geocoder/Provider/AbstractProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ public function setLocale($locale = null)
9292
}
9393

9494
/**
95-
* Sets the maximum of returned results.
96-
*
97-
* @param integer $maxResults
98-
*
99-
* @return AbstractProvider
95+
* {@inheritDoc}
10096
*/
10197
public function setMaxResults($maxResults)
10298
{

src/Geocoder/Provider/ChainProvider.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ public function getReversedData(array $coordinates)
7777
throw new NoResultException(sprintf('No provider could provide the coordinated %s', json_encode($coordinates)));
7878
}
7979

80+
/**
81+
* {@inheritDoc}
82+
*/
83+
public function setMaxResults($limit)
84+
{
85+
foreach ($this->providers as $provider) {
86+
$provider->setMaxResults($limit);
87+
}
88+
89+
return $this;
90+
}
91+
8092
/**
8193
* {@inheritDoc}
8294
*/

src/Geocoder/Provider/ProviderInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ public function getReversedData(array $coordinates);
5151
* @return string
5252
*/
5353
public function getName();
54+
55+
/**
56+
* Sets the maximum of returned results.
57+
*
58+
* @param integer $limit
59+
*
60+
* @return ProviderInterface
61+
*/
62+
public function setMaxResults($limit);
5463
}

0 commit comments

Comments
 (0)