| Current Path : /home/rtorresani/www/vendor/magento/module-two-factor-auth/Model/Config/Source/ |
| Current File : //home/rtorresani/www/vendor/magento/module-two-factor-auth/Model/Config/Source/Provider.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TwoFactorAuth\Model\Config\Source;
use Magento\Framework\Data\OptionSourceInterface;
use Magento\TwoFactorAuth\Api\TfaInterface;
/**
* LIst of 2FA providers
*/
class Provider implements OptionSourceInterface
{
/**
* @var TfaInterface
*/
private $tfa;
/**
* @param TfaInterface $tfa
*/
public function __construct(
TfaInterface $tfa
) {
$this->tfa = $tfa;
}
/**
* @inheritDoc
*/
public function toOptionArray()
{
$providers = $this->tfa->getAllProviders();
$res = [];
foreach ($providers as $provider) {
$res[] = [
'value' => $provider->getCode(),
'label' => $provider->getName(),
];
}
return $res;
}
}