Passed
Branch master (fbf0a6)
by Volodymyr
04:04
created

AuthenticationExceptionFailure   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 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\FailureInterface;
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 General $config
30
     */
31
    public function __construct(
32
        General $config
33
    ) {
34
        $this->config = $config;
35
    }
36
37
    /**
38
     * Handle captcha failure
39
     *
40
     * @param Response $verifyReCaptcha
41
     * @param ResponseInterface $response
42
     *
43
     * @return void
44
     * @throws AuthenticationException
45
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
46
     */
47
    public function execute(Response $verifyReCaptcha, ResponseInterface $response = null)
48
    {
49
        throw new AuthenticationException(__($this->getMessagesString($verifyReCaptcha)));
50
    }
51
}
52