From 20413ead5136feb04d46a8a3051906a0374c848c Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 1 Jul 2024 14:07:42 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Api/Services/IPApi.php | 2 +- src/Command/FetchIPInfoBatchHandler.php | 5 +++-- src/Command/FetchIPInfoHandler.php | 3 ++- src/Model/IPInfo.php | 1 - src/Repositories/GeoIPRepository.php | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Api/Services/IPApi.php b/src/Api/Services/IPApi.php index 61f20d3..f1aa2cb 100644 --- a/src/Api/Services/IPApi.php +++ b/src/Api/Services/IPApi.php @@ -81,7 +81,7 @@ protected function getRequestOptions(?string $apiKey, array $ips = null): array if ($ips && is_array($ips)) { // array is key => value, we only want values, then encode to json $ips = array_values($ips); - + return [ 'http_errors' => false, 'json' => $ips, diff --git a/src/Command/FetchIPInfoBatchHandler.php b/src/Command/FetchIPInfoBatchHandler.php index c7ae1f3..452c63f 100644 --- a/src/Command/FetchIPInfoBatchHandler.php +++ b/src/Command/FetchIPInfoBatchHandler.php @@ -21,13 +21,14 @@ class FetchIPInfoBatchHandler public function __construct( protected GeoIP $geoip, protected GeoIPRepository $repository - ) { } + ) { + } public function handle(FetchIPInfoBatch $command) { // remove any duplicates or invalid addresses from the ips array $command->ips = array_unique(array_filter($command->ips, fn ($ip) => $this->repository->isValidIP($ip))); - + // query the IPInfo model for all the ips in the command // if the ip doesn't exist, create a new IPInfo model diff --git a/src/Command/FetchIPInfoHandler.php b/src/Command/FetchIPInfoHandler.php index 73d2c5f..74905d8 100644 --- a/src/Command/FetchIPInfoHandler.php +++ b/src/Command/FetchIPInfoHandler.php @@ -22,7 +22,8 @@ class FetchIPInfoHandler public function __construct( protected GeoIP $geoip, protected GeoIPRepository $repository - ) { } + ) { + } public function handle(FetchIPInfo $command): IPInfo { diff --git a/src/Model/IPInfo.php b/src/Model/IPInfo.php index b646c4f..78e5d10 100644 --- a/src/Model/IPInfo.php +++ b/src/Model/IPInfo.php @@ -51,5 +51,4 @@ class IPInfo extends AbstractModel 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; - } diff --git a/src/Repositories/GeoIPRepository.php b/src/Repositories/GeoIPRepository.php index 4b49ef5..9f3d531 100644 --- a/src/Repositories/GeoIPRepository.php +++ b/src/Repositories/GeoIPRepository.php @@ -23,7 +23,8 @@ class GeoIPRepository public function __construct( protected GeoIP $geoIP, protected Queue $queue - ) { } + ) { + } /** * @param string|null $ip @@ -62,11 +63,10 @@ public function retrieveForPost(Post $post) /** * Determine if the given value is a valid IP address. - * + * * @param string $ip * * @return bool - * */ public function isValidIP(?string $ip): bool {