Code Duplication    Length = 28-28 lines in 3 locations

src/Action/CancelAction.php 1 location

@@ 13-40 (lines=28) @@
10
use PayumTW\Mypay\Request\Api\CancelTransaction;
11
use Payum\Core\Exception\RequestNotSupportedException;
12
13
class CancelAction implements ActionInterface, GatewayAwareInterface
14
{
15
    use GatewayAwareTrait;
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @param Cancel $request
21
     */
22
    public function execute($request)
23
    {
24
        RequestNotSupportedException::assertSupports($this, $request);
25
26
        $details = ArrayObject::ensureArrayObject($request->getModel());
27
28
        $this->gateway->execute(new CancelTransaction($details));
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function supports($request)
35
    {
36
        return
37
            $request instanceof Cancel &&
38
            $request->getModel() instanceof \ArrayAccess;
39
    }
40
}
41

src/Action/RefundAction.php 1 location

@@ 13-40 (lines=28) @@
10
use PayumTW\Mypay\Request\Api\RefundTransaction;
11
use Payum\Core\Exception\RequestNotSupportedException;
12
13
class RefundAction implements ActionInterface, GatewayAwareInterface
14
{
15
    use GatewayAwareTrait;
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @param Refund $request
21
     */
22
    public function execute($request)
23
    {
24
        RequestNotSupportedException::assertSupports($this, $request);
25
26
        $details = ArrayObject::ensureArrayObject($request->getModel());
27
28
        $this->gateway->execute(new RefundTransaction($details));
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function supports($request)
35
    {
36
        return
37
            $request instanceof Refund &&
38
            $request->getModel() instanceof \ArrayAccess;
39
    }
40
}
41

src/Action/SyncAction.php 1 location

@@ 13-40 (lines=28) @@
10
use PayumTW\Mypay\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
    public function execute($request)
23
    {
24
        RequestNotSupportedException::assertSupports($this, $request);
25
26
        $details = ArrayObject::ensureArrayObject($request->getModel());
27
28
        $this->gateway->execute(new GetTransactionData($details));
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function supports($request)
35
    {
36
        return
37
            $request instanceof Sync &&
38
            $request->getModel() instanceof \ArrayAccess;
39
    }
40
}
41