SyncAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 6
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 1
A supports() 0 6 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