src/Twig/ServerFeatureStateTwigRuntime.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Twig;
  4. use Slivki\Enum\SwitcherFeatures;
  5. use Slivki\Services\Switcher\ServerFeatureStateChecker;
  6. use Twig\Extension\RuntimeExtensionInterface;
  7. final class ServerFeatureStateTwigRuntime implements RuntimeExtensionInterface
  8. {
  9.     private ServerFeatureStateChecker $serverFeatureStateChecker;
  10.     public function __construct(ServerFeatureStateChecker $serverFeatureStateChecker)
  11.     {
  12.         $this->serverFeatureStateChecker $serverFeatureStateChecker;
  13.     }
  14.     public function isServerFeatureEnabled(int $featureId): bool
  15.     {
  16.         return $this->serverFeatureStateChecker->isServerFeatureEnabled(
  17.             SwitcherFeatures::byValue($featureId),
  18.         );
  19.     }
  20. }