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.

AbstractRequest::setPublicKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Omnipay\Tithely\Message;
4
5
use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest;
6
7
/**
8
 * Abstract Request
9
 *
10
 */
11
abstract class AbstractRequest extends BaseAbstractRequest
12
{
13
    protected $liveEndpoint = 'https://tithe.ly/api/v1';
14
    protected $testEndpoint = 'https://tithelydev.com/api/v1';
15
16
    public function getPublicKey()
17
    {
18
        return $this->getParameter('publicKey');
19
    }
20
21
    public function setPublicKey($value)
22
    {
23
        return $this->setParameter('publicKey', $value);
24
    }
25
26
    public function getPrivateKey()
27
    {
28
        return $this->getParameter('privateKey');
29
    }
30
31
    public function setPrivateKey($value)
32
    {
33
        return $this->setParameter('privateKey', $value);
34
    }
35
36
    public function getOrganizationId()
37
    {
38
        return $this->getParameter('organizationId');
39
    }
40
41
    public function setOrganizationId($value)
42
    {
43
        return $this->setParameter('organizationId', $value);
44
    }
45
46
    public function getGivingType()
47
    {
48
        return $this->getParameter('givingType');
49
    }
50
51
    public function setGivingType($value)
52
    {
53
        return $this->setParameter('givingType', $value);
54
    }
55
56
    public function sendData($data)
57
    {
58
        $url = $this->getEndpoint();
59
        $httpResponse = $this->httpClient->post(
60
            $url,
61
            null,
62
            $data,
63
            array(
64
                'auth' => array($this->getPublicKey(), $this->getPrivateKey())
65
            )
66
        )->send();
67
68
        return $this->createResponse($httpResponse->json());
69
    }
70
71
    public function getOrganization()
72
    {
73
        $httpResponse = $this->httpClient->get(
74
            self::getEndpoint() . '/organizations/' . $this->getOrganizationId(),
75
            null,
76
            array(
77
                'auth' => array($this->getPublicKey(), $this->getPrivateKey())
78
            )
79
        )->send();
80
81
        return $this->createResponse($httpResponse->json());
82
    }
83
84
    protected function getEndpoint()
85
    {
86
        return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
87
    }
88
89
    protected function createResponse($data)
90
    {
91
        return $this->response = new Response($this, $data);
92
    }
93
}
94