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

AuthenticationExceptionFailure::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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