<?php
declare(strict_types=1);
namespace Slivki\Twig;
use Slivki\Enum\SwitcherFeatures;
use Slivki\Services\Switcher\ServerFeatureStateChecker;
use Twig\Extension\RuntimeExtensionInterface;
final class ServerFeatureStateTwigRuntime implements RuntimeExtensionInterface
{
private ServerFeatureStateChecker $serverFeatureStateChecker;
public function __construct(ServerFeatureStateChecker $serverFeatureStateChecker)
{
$this->serverFeatureStateChecker = $serverFeatureStateChecker;
}
public function isServerFeatureEnabled(int $featureId): bool
{
return $this->serverFeatureStateChecker->isServerFeatureEnabled(
SwitcherFeatures::byValue($featureId),
);
}
}