BaseApiAwareAction::setApi()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 5
cp 0.8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2.032
1
<?php
2
3
namespace PayumTW\Ezship\Action\Api;
4
5
use PayumTW\Ezship\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\Collect\Api
14
     */
15
    protected $api;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 5
    public function setApi($api)
21
    {
22 5
        if (false === $api instanceof Api) {
23
            throw new UnsupportedApiException('Not supported.');
24
        }
25
26 5
        $this->api = $api;
27 5
    }
28
}
29