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.

PaymentResourceBase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
1
<?php
2
3
namespace zaporylie\Vipps\Resource\Payment;
4
5
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
6
use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
7
use JMS\Serializer\SerializerBuilder;
8
use zaporylie\Vipps\Resource\AuthorizedResourceBase;
9
use zaporylie\Vipps\Resource\RequestIdFactory;
10
11
/**
12
 * Class PaymentResourceBase
13
 *
14
 * @package Vipps\Resource\Payment
15
 */
16
abstract class PaymentResourceBase extends AuthorizedResourceBase
17
{
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function __construct(\zaporylie\Vipps\VippsInterface $vipps, $subscription_key)
23
    {
24
        parent::__construct($vipps, $subscription_key);
25
26
        // Adjust serializer.
27
        $this->serializer = SerializerBuilder::create()
28
            ->setPropertyNamingStrategy(new SerializedNameAnnotationStrategy(new IdenticalPropertyNamingStrategy()))
29
            ->build();
30
31
        // Content type for all requests must be set.
32
        $this->headers['Content-Type'] = 'application/json';
33
34
        // By default RequestID is different for each Resource object.
35
        $this->headers['X-Request-Id'] = RequestIdFactory::generate();
36
37
        // Timestamp is equal to current DateTime.
38
        $this->headers['X-TimeStamp'] = (new \DateTime())->format(\DateTime::ISO8601);
39
    }
40
}
41