Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Jul 1, 2024
1 parent 222b651 commit 20413ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Api/Services/IPApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/Command/FetchIPInfoBatchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/Command/FetchIPInfoHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class FetchIPInfoHandler
public function __construct(
protected GeoIP $geoip,
protected GeoIPRepository $repository
) { }
) {
}

public function handle(FetchIPInfo $command): IPInfo
{
Expand Down
1 change: 0 additions & 1 deletion src/Model/IPInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@ class IPInfo extends AbstractModel
'created_at' => 'datetime',
'updated_at' => 'datetime',
];

}
6 changes: 3 additions & 3 deletions src/Repositories/GeoIPRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class GeoIPRepository
public function __construct(
protected GeoIP $geoIP,
protected Queue $queue
) { }
) {
}

/**
* @param string|null $ip
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 20413ea

Please sign in to comment.