diff --git a/src/OpenFoodFacts.php b/src/OpenFoodFacts.php index 59d012c..a48d815 100644 --- a/src/OpenFoodFacts.php +++ b/src/OpenFoodFacts.php @@ -56,7 +56,6 @@ public function find($searchterm) $pages = (int)ceil($totalMatches / $pageResults->getPageSize()); $products = $products->concat(iterator_to_array($pageResults)); - } while ($page < $pages); return $products->map(function ($product) { diff --git a/src/OpenFoodFactsApiWrapper.php b/src/OpenFoodFactsApiWrapper.php index ce3c96d..e28282a 100644 --- a/src/OpenFoodFactsApiWrapper.php +++ b/src/OpenFoodFactsApiWrapper.php @@ -1,41 +1,41 @@ -parameters = $parameters; - $this->cache = $cache; - - $this->api = $this->setupApi(); - } - - protected function setupApi($environment = 'food') - { - return new Api( - $environment, - $this->parameters['geography'] ?? 'world', - null, - $this->httpClient(), - $this->cache - ); - } - - protected function httpClient() - { - return new Client([ - 'headers' => ['User-Agent' => $this->parameters['app'] ?? 'Laravel Open Food Facts - https://github.com/openfoodfacts/openfoodfacts-laravel'], - ]); - } -} +parameters = $parameters; + $this->cache = $cache; + + $this->api = $this->setupApi(); + } + + protected function setupApi($environment = 'food') + { + return new Api( + $environment, + $this->parameters['geography'] ?? 'world', + null, + $this->httpClient(), + $this->cache + ); + } + + protected function httpClient() + { + return new Client([ + 'headers' => ['User-Agent' => $this->parameters['app'] ?? 'Laravel Open Food Facts - https://github.com/openfoodfacts/openfoodfacts-laravel'], + ]); + } +} diff --git a/tests/Base/FacadeTestCase.php b/tests/Base/FacadeTestCase.php index 2dc67f9..27bef2e 100644 --- a/tests/Base/FacadeTestCase.php +++ b/tests/Base/FacadeTestCase.php @@ -1,14 +1,14 @@ -assertTrue($results->isNotEmpty()); - $results->each(function($arr) { + $results->each(function ($arr) { $this->assertIsArray($arr); }); }