From e6cd037789984c71f8be139f4d878fc05db2ab15 Mon Sep 17 00:00:00 2001 From: Mark Harding Date: Thu, 28 Mar 2024 13:17:47 +0000 Subject: [PATCH] (chore): Make the feature flag fetch optional --- lib/Client.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Client.php b/lib/Client.php index 096f14d..389fdcb 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -80,7 +80,8 @@ public function __construct( string $apiKey, array $options = [], ?HttpClient $httpClient = null, - string $personalAPIKey = null + string $personalAPIKey = null, + bool $loadFeatureFlags = true, ) { $this->apiKey = $apiKey; $this->personalAPIKey = $personalAPIKey; @@ -102,7 +103,11 @@ public function __construct( $this->distinctIdsFeatureFlagsReported = new SizeLimitedHash(SIZE_LIMIT); // Populate featureflags and grouptypemapping if possible - if (count($this->featureFlags) == 0 && !is_null($this->personalAPIKey)) { + if ( + count($this->featureFlags) == 0 + && !is_null($this->personalAPIKey) + && $loadFeatureFlags + ) { $this->loadFlags(); } }