* ... * * ``` * * @see https://docs.typo3.org/permalink/t3viewhelper:typo3-backend-mfa-ifhasstate * @internal */ final class IfHasStateViewHelper extends AbstractConditionViewHelper { public function initializeArguments(): void { parent::initializeArguments(); $this->registerArgument('state', 'string', 'The state to check for (e.g. active or locked)', true); $this->registerArgument('provider', MfaProviderManifestInterface::class, 'The provider in question', true); } /** * @param array{state: string, provider: MfaProviderManifestInterface} $arguments */ public static function verdict(array $arguments, RenderingContextInterface $renderingContext): bool { $stateMethod = 'is' . ucfirst($arguments['state']); $provider = $arguments['provider']; $propertyManager = MfaProviderPropertyManager::create($provider, $GLOBALS['BE_USER']); return is_callable([$provider, $stateMethod]) && $provider->{$stateMethod}($propertyManager); } }