Code Duplication    Length = 39-42 lines in 4 locations

src/Method/Payment/Get.php 1 location

@@ 8-46 (lines=39) @@
5
use Cardinity\Method\MethodInterface;
6
use Symfony\Component\Validator\Constraints as Assert;
7
8
class Get implements MethodInterface
9
{
10
    private $paymentId;
11
12
    public function __construct($paymentId)
13
    {
14
        $this->paymentId = $paymentId;
15
    }
16
17
    public function getPaymentId()
18
    {
19
        return $this->paymentId;
20
    }
21
22
    public function getAction()
23
    {
24
        return sprintf('payments/%s', $this->getPaymentId());
25
    }
26
27
    public function getMethod()
28
    {
29
        return MethodInterface::GET;
30
    }
31
32
    public function createResultObject()
33
    {
34
        return new Payment();
35
    }
36
37
    public function getAttributes()
38
    {
39
        return [];
40
    }
41
42
    public function getValidationConstraints()
43
    {
44
        return new Assert\Collection([]);
45
    }
46
}
47

src/Method/Refund/GetAll.php 1 location

@@ 9-50 (lines=42) @@
6
use Cardinity\Method\MethodResultCollectionInterface;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class GetAll implements MethodResultCollectionInterface
10
{
11
    private $paymentId;
12
13
    public function __construct($paymentId)
14
    {
15
        $this->paymentId = $paymentId;
16
    }
17
18
    public function getAction()
19
    {
20
        return sprintf(
21
            'payments/%s/refunds',
22
            $this->getPaymentId()
23
        );
24
    }
25
26
    public function getMethod()
27
    {
28
        return MethodInterface::GET;
29
    }
30
31
    public function createResultObject()
32
    {
33
        return new Refund();
34
    }
35
36
    public function getAttributes()
37
    {
38
        return [];
39
    }
40
41
    public function getValidationConstraints()
42
    {
43
        return new Assert\Collection([]);
44
    }
45
46
    public function getPaymentId()
47
    {
48
        return $this->paymentId;
49
    }
50
}
51

src/Method/Settlement/GetAll.php 1 location

@@ 9-50 (lines=42) @@
6
use Cardinity\Method\MethodResultCollectionInterface;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class GetAll implements MethodResultCollectionInterface
10
{
11
    private $paymentId;
12
13
    public function __construct($paymentId)
14
    {
15
        $this->paymentId = $paymentId;
16
    }
17
18
    public function getAction()
19
    {
20
        return sprintf(
21
            'payments/%s/settlements',
22
            $this->getPaymentId()
23
        );
24
    }
25
26
    public function getMethod()
27
    {
28
        return MethodInterface::GET;
29
    }
30
31
    public function createResultObject()
32
    {
33
        return new Settlement();
34
    }
35
36
    public function getAttributes()
37
    {
38
        return [];
39
    }
40
41
    public function getValidationConstraints()
42
    {
43
        return new Assert\Collection([]);
44
    }
45
46
    public function getPaymentId()
47
    {
48
        return $this->paymentId;
49
    }
50
}
51

src/Method/VoidPayment/GetAll.php 1 location

@@ 9-50 (lines=42) @@
6
use Cardinity\Method\MethodResultCollectionInterface;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class GetAll implements MethodResultCollectionInterface
10
{
11
    private $paymentId;
12
13
    public function __construct($paymentId)
14
    {
15
        $this->paymentId = $paymentId;
16
    }
17
18
    public function getAction()
19
    {
20
        return sprintf(
21
            'payments/%s/voids',
22
            $this->getPaymentId()
23
        );
24
    }
25
26
    public function getMethod()
27
    {
28
        return MethodInterface::GET;
29
    }
30
31
    public function createResultObject()
32
    {
33
        return new VoidPayment();
34
    }
35
36
    public function getAttributes()
37
    {
38
        return [];
39
    }
40
41
    public function getValidationConstraints()
42
    {
43
        return new Assert\Collection([]);
44
    }
45
46
    public function getPaymentId()
47
    {
48
        return $this->paymentId;
49
    }
50
}
51