diff --git a/src/Read/Toggle.php b/src/Read/Toggle.php index 2cb6802..d4b83aa 100644 --- a/src/Read/Toggle.php +++ b/src/Read/Toggle.php @@ -6,7 +6,6 @@ final class Toggle { - private const ZERO = 0; private FeatureFinder $featureFinder; public function __construct(FeatureFinder $featureRepository) @@ -24,7 +23,7 @@ public function isEnabled(string $featureId, ?ConsumerIdentity $identity = null) $strategies = $feature->strategies(); - if (self::ZERO === $strategies->count() || null === $identity) { + if ($strategies->isEmpty() || null === $identity) { return true; } diff --git a/src/Read/ToggleStrategies.php b/src/Read/ToggleStrategies.php index 706498b..4db126a 100644 --- a/src/Read/ToggleStrategies.php +++ b/src/Read/ToggleStrategies.php @@ -30,6 +30,11 @@ public function count(): int return count($this->strategies); } + public function isEmpty(): bool + { + return $this->strategies === []; + } + /** @return Generator */ public function getIterator(): Generator {