Code Duplication    Length = 41-45 lines in 2 locations

src/Controller/Adminhtml/Adminlogin/Index.php 1 location

@@ 33-77 (lines=45) @@
30
use Rossmitchell\Twofactor\Model\Urls\Fetcher;
31
use Rossmitchell\Twofactor\Model\Admin\Attribute\IsUsingTwoFactor;
32
33
class Index extends AbstractController
34
{
35
36
    private $resultPageFactory;
37
38
    /**
39
     * Constructor
40
     *
41
     * @param Context          $context
42
     * @param UserAdmin        $userAdmin
43
     * @param AdminUser        $adminGetter
44
     * @param Fetcher          $fetcher
45
     * @param IsUsingTwoFactor $isUsingTwoFactor
46
     * @param PageFactory      $resultPageFactory
47
     */
48
    public function __construct(
49
        Context $context,
50
        UserAdmin $userAdmin,
51
        AdminUser $adminGetter,
52
        Fetcher $fetcher,
53
        IsUsingTwoFactor $isUsingTwoFactor,
54
        PageFactory $resultPageFactory
55
    ) {
56
        parent::__construct($context, $userAdmin, $adminGetter, $fetcher, $isUsingTwoFactor);
57
        $this->resultPageFactory = $resultPageFactory;
58
    }
59
60
    /**
61
     * Execute view action
62
     *
63
     * @return ResultInterface
64
     */
65
    public function execute()
66
    {
67
        if ($this->shouldActionBeRun() === false) {
68
            return $this->getRedirectAction();
69
        }
70
        return $this->resultPageFactory->create();
71
    }
72
73
    protected function _isAllowed()
74
    {
75
        return true;
76
    }
77
}
78

src/Controller/Customerlogin/Index.php 1 location

@@ 33-73 (lines=41) @@
30
use Rossmitchell\Twofactor\Model\TwoFactorUrls;
31
use Rossmitchell\Twofactor\Model\Urls\Fetcher;
32
33
class Index extends AbstractController
34
{
35
    /** @var PageFactory  */
36
    private $resultPageFactory;
37
38
    /**
39
     * Index constructor.
40
     *
41
     * @param Context $context
42
     * @param CustomerAdmin $customerAdmin
43
     * @param Customer $customerGetter
44
     * @param Fetcher $fetcher
45
     * @param IsUsingTwoFactor $isUsingTwoFactor
46
     * @param PageFactory $resultPageFactory
47
     */
48
    public function __construct(
49
        Context $context,
50
        CustomerAdmin $customerAdmin,
51
        Customer $customerGetter,
52
        Fetcher $fetcher,
53
        IsUsingTwoFactor $isUsingTwoFactor,
54
        PageFactory $resultPageFactory
55
    ) {
56
        parent::__construct($context, $customerAdmin, $customerGetter, $fetcher, $isUsingTwoFactor);
57
        $this->resultPageFactory = $resultPageFactory;
58
    }
59
60
    /**
61
     * Execute view action
62
     *
63
     * @return ResultInterface
64
     */
65
    public function execute()
66
    {
67
        if ($this->shouldActionBeRun() === false) {
68
            return $this->getRedirectAction();
69
        }
70
71
        return $this->resultPageFactory->create();
72
    }
73
}
74