RefundAction::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PayumTW\Mypay\Action;
4
5
use Payum\Core\Request\Refund;
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\Mypay\Request\Api\RefundTransaction;
11
use Payum\Core\Exception\RequestNotSupportedException;
12
13 View Code Duplication
class RefundAction implements ActionInterface, GatewayAwareInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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 RefundTransaction($details));
29 1
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function supports($request)
35
    {
36
        return
37 1
            $request instanceof Refund &&
38 1
            $request->getModel() instanceof \ArrayAccess;
39
    }
40
}
41