AuthenticationExceptionFailure   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 35
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A execute() 0 3 1
1
<?php
2
/**
3
 * Copyright (c) 2019. Volodymyr Hryvinskyi.  All rights reserved.
4
 * @author: <mailto:[email protected]>
5
 * @github: <https://github.com/hryvinskyi>
6
 */
7
8
declare(strict_types=1);
9
10
namespace Hryvinskyi\InvisibleCaptcha\Model\Provider\Failure;
11
12
use Hryvinskyi\InvisibleCaptcha\Helper\Config\General;
13
use Hryvinskyi\InvisibleCaptcha\Model\Provider\AbstractFailure;
14
use Hryvinskyi\InvisibleCaptcha\Model\Provider\FailureMessages;
15
use Hryvinskyi\InvisibleCaptcha\Model\ReCaptcha\Response;
16
use Magento\Framework\App\ResponseInterface;
17
use Magento\Framework\Exception\Plugin\AuthenticationException;
18
19
class AuthenticationExceptionFailure extends AbstractFailure
20
{
21
    /**
22
     * @var General
23
     */
24
    private $config;
25
26
    /**
27
     * AuthenticationExceptionFailure constructor.
28
     *
29
     * @param FailureMessages $failureMessages
30
     * @param General $config
31
     */
32
    public function __construct(
33
        FailureMessages $failureMessages,
34
        General $config
35
    ) {
36
        parent::__construct($failureMessages);
37
38
        $this->config = $config;
39
    }
40
41
    /**
42
     * Handle captcha failure
43
     *
44
     * @param Response $verifyReCaptcha
45
     * @param ResponseInterface $response
46
     *
47
     * @return void
48
     * @throws AuthenticationException
49
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
50
     */
51
    public function execute(Response $verifyReCaptcha, ResponseInterface $response = null)
52
    {
53
        throw new AuthenticationException(__($this->getMessagesString($verifyReCaptcha)));
54
    }
55
}
56