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.
Completed
Push — master ( d88fce...019e6b )
by Alexander
03:10
created

ServiceClientBase::setNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * (c) Alexander Zhukov <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Zbox\UnifiedPush\NotificationService;
11
12
use Zbox\UnifiedPush\Exception\InvalidArgumentException;
13
14
/**
15
 * Class ServiceClientBase
16
 * @package Zbox\UnifiedPush\NotificationService
17
 */
18
abstract class ServiceClientBase implements ServiceClientInterface
19
{
20
    /**
21
     * @var array
22
     */
23
    protected $serviceURL;
24
25
    /**
26
     * @var CredentialsInterface
27
     */
28
    protected $credentials;
29
30
    /**
31
     * @var array
32
     */
33
    protected $notification;
34
35
    /**
36
     * @var mixed
37
     */
38
    protected $serviceClient;
39
40
    /**
41
     * @param array $serviceUrl
42
     * @param CredentialsInterface $credentials
43
     */
44
    public function __construct($serviceUrl, CredentialsInterface $credentials)
45
    {
46
        $this->setServiceURL($serviceUrl);
47
        $this->setCredentials($credentials);
48
49
        $this->createClient();
50
51
        return $this;
52
    }
53
54
    abstract protected function createClient();
55
56
    /**
57
     * @param array $serviceURL
58
     * @return $this
59
     */
60
    public function setServiceURL($serviceURL)
61
    {
62
        $this->serviceURL = $serviceURL;
63
        return $this;
64
    }
65
66
    /**
67
     * @return array
68
     */
69
    public function getServiceURL()
70
    {
71
        return $this->serviceURL;
72
    }
73
74
    /**
75
     * @param CredentialsInterface $credentials
76
     * @return $this
77
     */
78
    public function setCredentials(CredentialsInterface $credentials)
79
    {
80
        $this->credentials = $credentials;
81
        return $this;
82
    }
83
84
    /**
85
     * @return CredentialsInterface
86
     */
87
    public function getCredentials()
88
    {
89
        return $this->credentials;
90
    }
91
92
    /**
93
     * @param array $notification
94
     * @return $this
95
     */
96
    public function setNotification($notification)
97
    {
98
        $this->notification = $notification;
99
        return $this;
100
    }
101
102
    /**
103
     * @return array
104
     */
105
    public function getNotificationOrThrowException()
106
    {
107
        if (empty($this->notification)) {
108
            throw new InvalidArgumentException('Missing notification');
109
        }
110
111
        return $this->notification;
112
    }
113
114
    /**
115
     * @return mixed
116
     */
117
    public function getClientConnection()
118
    {
119
        return $this->serviceClient;
120
    }
121
}
122