CancelTransactionAction::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PayumTW\Esunbank\Action\Api;
4
5
use Payum\Core\Bridge\Spl\ArrayObject;
6
use PayumTW\Esunbank\Request\Api\CancelTransaction;
7
use Payum\Core\Exception\RequestNotSupportedException;
8
9 View Code Duplication
class CancelTransactionAction extends BaseApiAwareAction
10
{
11
    /**
12
     * {@inheritdoc}
13
     *
14
     * @param $request RefundTransaction
15
     */
16 1
    public function execute($request)
17
    {
18 1
        RequestNotSupportedException::assertSupports($this, $request);
19
20 1
        $details = ArrayObject::ensureArrayObject($request->getModel());
21
22 1
        $details->validateNotEmpty(['ONO']);
23
24 1
        $details->replace($this->api->cancelTransaction((array) $details));
25 1
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 1
    public function supports($request)
31
    {
32
        return
33 1
            $request instanceof CancelTransaction &&
34 1
            $request->getModel() instanceof \ArrayAccess;
35
    }
36
}
37