ApiAwareTrait::setApi()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusQuadPayPlugin\Action\Api;
14
15
use BitBag\SyliusQuadPayPlugin\Client\QuadPayApiClientInterface;
16
use Payum\Core\Exception\UnsupportedApiException;
17
18
trait ApiAwareTrait
19
{
20
    /** @var QuadPayApiClientInterface */
21
    protected $quadPayApiClient;
22
23
    public function setApi($quadPayApiClient): void
24
    {
25
        if (false === $quadPayApiClient instanceof QuadPayApiClientInterface) {
26
            throw new UnsupportedApiException('Not supported.Expected an instance of ' . QuadPayApiClientInterface::class);
27
        }
28
29
        $this->quadPayApiClient = $quadPayApiClient;
30
    }
31
}
32