From ec489d2d93cb7e0528672ba5e20e22dced311d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 6 Aug 2021 16:12:41 +0200 Subject: [PATCH] phpcs fix --- app/Exceptions/Handler.php | 1 + app/Http/Controllers/CustomerController.php | 18 +++++++++--------- app/Http/Controllers/ServiceController.php | 1 + app/Providers/RouteServiceProvider.php | 3 ++- tests/Feature/ApiV2/CustomerTest.php | 7 ++++--- tests/Unit/CrmClientV2ArcadiaTest.php | 4 ++-- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 84eabe1..3b93ee2 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -86,6 +86,7 @@ class Handler extends ExceptionHandler * * @throws \Throwable */ + // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh public function render($request, Throwable $e) { if (Helper::isRequestForApiV2($request) and $request->isJson()) { diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 55387ed..3f9831d 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -29,14 +29,14 @@ class CustomerController extends Controller if ($brand) { $customers = Customer::join('customer_infos', 'customers.id', '=', 'customer_infos.customer_id') ->join('customer_logins', 'customers.id', '=', 'customer_logins.customer_id')->select( - 'customer_infos.customer_id', - 'customer_infos.firstname', - 'customer_infos.lastname', - 'customer_infos.opt_in', - 'customers.email', - 'customer_infos.brand_id', - 'customer_logins.last_connection' - )->where([ + 'customer_infos.customer_id', + 'customer_infos.firstname', + 'customer_infos.lastname', + 'customer_infos.opt_in', + 'customers.email', + 'customer_infos.brand_id', + 'customer_logins.last_connection' + )->where([ ['lastname', 'like', '%' . $texte . '%'], ['customer_infos.brand_id', $brand->id], ['customer_logins.brand_id', $brand->id] @@ -57,7 +57,7 @@ class CustomerController extends Controller 'customer_infos.opt_in', 'customers.email', 'customer_infos.brand_id', - 'customer_logins.last_connection' + 'customer_logins.last_connection' )->where('lastname', 'like', '%' . $texte . '%') ->orWhere('email', 'like', '%' . $texte . '%')->get(); } diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index 11a4eab..52b40a3 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -44,6 +44,7 @@ class ServiceController extends Controller $bearerPwd = $service->bearer_pwd; $service->saveOrFail(); return back() + // phpcs:ignore Generic.Files.LineLength.TooLong ->with('success', "Nouveau token d'API de $service->name : '$service->bearer_token' et mot de passe '$bearerPwd'"); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 67d2595..d80193e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -51,7 +51,8 @@ class RouteServiceProvider extends ServiceProvider protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(config('api.apiRequestRatePerMinute'))->by(optional($request->user())->id ?: $request->ip()); + return Limit::perMinute(config('api.apiRequestRatePerMinute')) + ->by(optional($request->user())->id ?: $request->ip()); }); } } diff --git a/tests/Feature/ApiV2/CustomerTest.php b/tests/Feature/ApiV2/CustomerTest.php index 1bbd64b..4fe3800 100644 --- a/tests/Feature/ApiV2/CustomerTest.php +++ b/tests/Feature/ApiV2/CustomerTest.php @@ -188,9 +188,10 @@ class CustomerTest extends ApiBase ); } } - $response = $this->callApiWithToken($service, 'patch', route('apiV2.customer.update', ['customer' => $info->hashcode]), [ - 'address2' => 'anything' - ]); + $response = $this->callApiWithToken($service, 'patch', route( + 'apiV2.customer.update', + ['customer' => $info->hashcode] + ), ['address2' => 'anything']); $json = $response->decodeResponseJson(); $this->assertApiResponseStatusIs($json, ApiStatus::KO()); $this->assertEquals(ApiError::validationFailed()->value, $json->json('data.code')); diff --git a/tests/Unit/CrmClientV2ArcadiaTest.php b/tests/Unit/CrmClientV2ArcadiaTest.php index f5de599..f87a21c 100644 --- a/tests/Unit/CrmClientV2ArcadiaTest.php +++ b/tests/Unit/CrmClientV2ArcadiaTest.php @@ -30,8 +30,8 @@ class CrmClientV2ArcadiaTest extends CrmClientTester public function testArcadiaSendOrderGame() { - $api = new CrmApiV2(); - $customer = $api->getCustomerOrNew(static::$info->hashcode); + $api = new CrmApiV2(); + $customer = $api->getCustomerOrNew(static::$info->hashcode); $arcadiaOrderMail = new ArcadiaMailGame([ 'operation' => 16, 'order_date' => date('Y/m/d H:i:s'),