BaseApiAwareAction::setApi()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 4
cts 5
cp 0.8
cc 2
nc 2
nop 1
crap 2.032
1
<?php
2
3
namespace PayumTW\Allpay\Action\Api;
4
5
use PayumTW\Allpay\Api;
6
use Payum\Core\ApiAwareInterface;
7
use Payum\Core\Action\ActionInterface;
8
use Payum\Core\Exception\UnsupportedApiException;
9
10
abstract class BaseApiAwareAction implements ActionInterface, ApiAwareInterface
11
{
12
    /**
13
     * @var \Payum\Allpay\Api
14
     */
15
    protected $api;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 7
    public function setApi($api)
21
    {
22 7
        if (false === $api instanceof Api) {
23
            throw new UnsupportedApiException('Not supported.');
24
        }
25
26 7
        $this->api = $api;
27 7
    }
28
}
29