A free open source IT asset/license management system
Small fixes for codacy
sniped166718b9da2
diff --git a/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php b/app/SyncAdapters/JumpCloud/JumpCloudAdapter.phpindex 6de583dc18..ec50d6a32e 100644--- a/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php+++ b/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php@@ -113,12 +113,14 @@ class JumpCloudAdapter extends SyncAdapterLog::channel('sync-adapters')->info($this->name().': API key does not have System Insights permission (403), falling back to V1 /systems fields only.',);- } else {- Log::channel('sync-adapters')->warning(- $this->name().': V2 System Insights fetch failed (HTTP '.($status ?? 'n/a').'), falling back to V1 /systems fields only.',- ['exception' => $e->getMessage()],- );++ return $map;}++ Log::channel('sync-adapters')->warning(+ $this->name().': V2 System Insights fetch failed (HTTP '.($status ?? 'n/a').'), falling back to V1 /systems fields only.',+ ['exception' => $e->getMessage()],+ );}return $map;diff --git a/app/SyncAdapters/JumpCloud/JumpCloudClient.php b/app/SyncAdapters/JumpCloud/JumpCloudClient.phpindex 2887bed8f5..36479366f6 100644--- a/app/SyncAdapters/JumpCloud/JumpCloudClient.php+++ b/app/SyncAdapters/JumpCloud/JumpCloudClient.php@@ -94,14 +94,16 @@ class JumpCloudClient// V2 System Insights returns a flat array of records (no// envelope / totalCount), so pagination terminates on a- // short page.+ // short page. Capture the page size once into a variable+ // so the while condition isn't a call expression.$results = is_array($response) ? $response : [];+ $pageSize = count($results);foreach ($results as $insight) {yield $insight;}$skip += $limit;- } while (count($results) >= $limit);+ } while ($pageSize >= $limit);}private function request(): PendingRequest