Skip to content

Commit

Permalink
Format code with php-cs-fixer
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 4cdc0d8 according to the output
from php-cs-fixer.

Details: https://deepsource.io/gh/openfoodfacts/openfoodfacts-laravel/transform/6fda8665-0a81-447f-be93-a28aee77d8b4/
  • Loading branch information
deepsource-autofix[bot] authored Sep 28, 2021
1 parent 4cdc0d8 commit dff16c6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/OpenFoodFacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
82 changes: 41 additions & 41 deletions src/OpenFoodFactsApiWrapper.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<?php

namespace OpenFoodFacts\Laravel;

use GuzzleHttp\Client;
use OpenFoodFacts\Api;
use Psr\SimpleCache\CacheInterface;

class OpenFoodFactsApiWrapper
{
protected $parameters;
protected $cache;

public $api;

public function __construct(array $parameters, CacheInterface $cache = null)
{
$this->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'],
]);
}
}
<?php

namespace OpenFoodFacts\Laravel;

use GuzzleHttp\Client;
use OpenFoodFacts\Api;
use Psr\SimpleCache\CacheInterface;

class OpenFoodFactsApiWrapper
{
protected $parameters;
protected $cache;

public $api;

public function __construct(array $parameters, CacheInterface $cache = null)
{
$this->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'],
]);
}
}
28 changes: 14 additions & 14 deletions tests/Base/FacadeTestCase.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace OpenFoodFacts\Laravel\Tests\Base;

use Orchestra\Testbench\TestCase;
use OpenFoodFacts\Laravel\OpenFoodFactsServiceProvider;

abstract class FacadeTestCase extends TestCase
{
protected function getPackageProviders($app)
{
return [OpenFoodFactsServiceProvider::class];
}
}
<?php

namespace OpenFoodFacts\Laravel\Tests\Base;

use Orchestra\Testbench\TestCase;
use OpenFoodFacts\Laravel\OpenFoodFactsServiceProvider;

abstract class FacadeTestCase extends TestCase
{
protected function getPackageProviders($app)
{
return [OpenFoodFactsServiceProvider::class];
}
}
2 changes: 1 addition & 1 deletion tests/ProductSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function it_returns_a_laravelcollection_with_arrays()

$this->assertTrue($results->isNotEmpty());

$results->each(function($arr) {
$results->each(function ($arr) {
$this->assertIsArray($arr);
});
}
Expand Down

0 comments on commit dff16c6

Please sign in to comment.