GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CapturePayment   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 56
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A call() 0 15 1
1
<?php
2
3
namespace zaporylie\Vipps\Resource\Payment;
4
5
use zaporylie\Vipps\Model\Payment\RequestCapturePayment;
6
use zaporylie\Vipps\Model\Payment\ResponseCapturePayment;
7
use zaporylie\Vipps\Resource\HttpMethod;
8
use zaporylie\Vipps\VippsInterface;
9
10
/**
11
 * Class CapturePayment
12
 *
13
 * @package Vipps\Resource\Payment
14
 */
15
class CapturePayment extends PaymentResourceBase
16
{
17
18
    /**
19
     * @var \zaporylie\Vipps\Resource\HttpMethod
20
     */
21
    protected $method = HttpMethod::POST;
22
23
    /**
24
     * @var string
25
     */
26
    protected $path = '/ecomm/v2/payments/{id}/capture';
27
28
    /**
29
     * InitiatePayment constructor.
30
     *
31
     * @param \zaporylie\Vipps\VippsInterface $vipps
32
     * @param string $subscription_key
33
     * @param string $order_id
34
     * @param \zaporylie\Vipps\Model\Payment\RequestCapturePayment $requestObject
35
     */
36
    public function __construct(
37
        VippsInterface $vipps,
38
        $subscription_key,
39
        $order_id,
40
        RequestCapturePayment $requestObject
41
    ) {
42
        parent::__construct($vipps, $subscription_key);
43
        $this->body = $this
44
            ->getSerializer()
45
            ->serialize(
46
                $requestObject,
47
                'json'
48
            );
49
        $this->id = $order_id;
50
    }
51
52
    /**
53
     * @return \zaporylie\Vipps\Model\Payment\ResponseCapturePayment
54
     */
55
    public function call()
56
    {
57
        $response = $this->makeCall();
58
        $body = $response->getBody()->getContents();
59
        /** @var \zaporylie\Vipps\Model\Payment\ResponseCapturePayment $responseObject */
60
        $responseObject = $this
61
            ->getSerializer()
62
            ->deserialize(
63
                $body,
64
                ResponseCapturePayment::class,
65
                'json'
66
            );
67
68
        return $responseObject;
69
    }
70
}
71