Passed
Pull Request — master (#94)
by
unknown
07:43
created

ApiKeysTestResolver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
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\Resolver;
13
14
use BitBag\SyliusMolliePlugin\Creator\ApiKeysTestCreatorInterface;
15
use BitBag\SyliusMolliePlugin\Form\Type\MollieGatewayConfigurationType;
16
use Symfony\Component\HttpFoundation\Request;
17
18
final class ApiKeysTestResolver implements ApiKeysTestResolverInterface
19
{
20
    /** @var ApiKeysTestCreatorInterface */
21
    private $apiKeysTestCreator;
22
23
    public function __construct(
24
        ApiKeysTestCreatorInterface $apiKeysTestCreator
25
    ) {
26
        $this->apiKeysTestCreator = $apiKeysTestCreator;
27
    }
28
29
    public function fromRequest(Request $request): array
30
    {
31
        $testApiKey = $request->get(MollieGatewayConfigurationType::API_KEY_TEST);
32
        $liveApiKey = $request->get(MollieGatewayConfigurationType::API_KEY_LIVE);
33
34
        return [
35
            $this->apiKeysTestCreator->create(MollieGatewayConfigurationType::API_KEY_TEST, $testApiKey),
36
            $this->apiKeysTestCreator->create(MollieGatewayConfigurationType::API_KEY_LIVE, $liveApiKey),
37
        ];
38
    }
39
}
40