TestApiKeysAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __invoke() 0 8 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Controller\Action\Admin;
13
14
use BitBag\SyliusMolliePlugin\Resolver\ApiKeysTestResolverInterface;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpFoundation\Response;
17
use Twig\Environment;
18
19
final class TestApiKeysAction
20
{
21
    /** @var ApiKeysTestResolverInterface */
22
    private $apiKeysTestResolver;
23
24
    /** @var Environment */
25
    private $twig;
26
27
    public function __construct(
28
        ApiKeysTestResolverInterface $apiKeysTestResolver,
29
        Environment $twig
30
    ) {
31
        $this->apiKeysTestResolver = $apiKeysTestResolver;
32
        $this->twig = $twig;
33
    }
34
35
    public function __invoke(Request $request): Response
36
    {
37
        $data = $this->apiKeysTestResolver->fromRequest($request);
38
39
        return new Response($this->twig->render(
40
            '@BitBagSyliusMolliePlugin/Admin/PaymentMethod/testApiKeys.html.twig',
41
            [
42
                'tests' => $data,
43
            ]
44
        ));
45
    }
46
}
47