SyncAction::supports()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace PayumTW\Ezship\Action;
4
5
use Payum\Core\Request\Sync;
6
use Payum\Core\GatewayAwareTrait;
7
use Payum\Core\GatewayAwareInterface;
8
use Payum\Core\Action\ActionInterface;
9
use Payum\Core\Bridge\Spl\ArrayObject;
10
use PayumTW\Ezship\Request\Api\GetTransactionData;
11
use Payum\Core\Exception\RequestNotSupportedException;
12
13
class SyncAction implements ActionInterface, GatewayAwareInterface
14
{
15
    use GatewayAwareTrait;
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @param Refund $request
21
     */
22 1
    public function execute($request)
23
    {
24 1
        RequestNotSupportedException::assertSupports($this, $request);
25
26 1
        $details = ArrayObject::ensureArrayObject($request->getModel());
27
28 1
        $this->gateway->execute(new GetTransactionData($details));
29 1
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function supports($request)
35
    {
36
        return
37 1
            $request instanceof Sync &&
38 1
            $request->getModel() instanceof \ArrayAccess;
39
    }
40
}
41