Skip to content

Commit

Permalink
Add limit for json feed
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrimaud committed Mar 1, 2019
1 parent 0754d1b commit f4c307b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Instagram/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ public function __construct(CacheManager $cacheManager = null, Client $client =
}

/**
* @param integer $limit
* @return Hydrator\Component\Feed
*
* @throws Exception\CacheException
* @throws CacheException
* @throws InstagramException
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Exception
*/
public function getFeed()
public function getFeed($limit = 12)
{
if (empty($this->userName)) {
throw new InstagramException('Username cannot be empty');
}

if ($this->endCursor) {

if (!$this->cacheManager instanceof CacheManager) {
throw new CacheException('CacheManager object must be specified to use pagination');
}
Expand All @@ -71,7 +71,7 @@ public function getFeed()
$hydrator = new HtmlHydrator();
}

$dataFetched = $feed->fetchData($this->userName);
$dataFetched = $feed->fetchData($this->userName, $limit);

$hydrator->setData($dataFetched);

Expand Down
2 changes: 1 addition & 1 deletion src/Instagram/Transport/JsonTransportFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function generateGis($rhxgis, $variables)
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Instagram\Exception\CacheException
*/
public function fetchData($userName, $limit = 12)
public function fetchData($userName, $limit)
{
/** @var Cache $cache */
$cache = $this->cacheManager->getCache($userName);
Expand Down

0 comments on commit f4c307b

Please sign in to comment.