diff --git a/src/Providers/LaunchDarkly/LaunchDarklyProvider.php b/src/Providers/LaunchDarkly/LaunchDarklyProvider.php index 0b85e80..e8fd130 100644 --- a/src/Providers/LaunchDarkly/LaunchDarklyProvider.php +++ b/src/Providers/LaunchDarkly/LaunchDarklyProvider.php @@ -24,6 +24,8 @@ public function __construct() { /** @var array */ $config = Config::get('feature-flags.providers.launchdarkly.options', []); + + /** @var array */ $options = array_merge([ 'event_publisher' => Guzzle::eventPublisher() ], $config); @@ -32,6 +34,7 @@ public function __construct() $key = Config::get('feature-flags.providers.launchdarkly.key'); if ($key) { + /** @phpstan-ignore-next-line */ $this->client = new LDClient($key, $options); } } diff --git a/src/Traits/InteractsWithFeatureFlags.php b/src/Traits/InteractsWithFeatureFlags.php new file mode 100644 index 0000000..f1ae1e8 --- /dev/null +++ b/src/Traits/InteractsWithFeatureFlags.php @@ -0,0 +1,25 @@ +app['config']->set('feature-flags.overrides.'.$key, $onOff); + } + + public function enableFeatureFlag(string $key): void + { + + $this->switchFeatureFlag($key, true); + } + + public function disableFeatureFlag(string $key): void + { + + $this->switchFeatureFlag($key, false); + } +}