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.
Test Failed
Push — 2.0 ( f54447...14ab12 )
by Nico
11:00
created

Subscription   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 60
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A Get() 0 7 2
A Create() 0 4 1
A Update() 0 7 2
A Delete() 0 4 1
1
<?php
2
namespace Datatrics\API\Modules;
3
4
use Datatrics\API\Client;
5
6
class Subscription extends Base
7
{
8
    /**
9
     * Private constructor so only the client can create this
10
     * @param Client $client
11
     */
12
    public function __construct(Client $client)
13
    {
14
        parent::__construct($client);
15
        $this->SetUrl("/project/" . $this->GetClient()->GetProjectId() . "/subscription");
16
    }
17
18
    /**
19
     * Get one or multiple subscriptions
20
     * @param string subscription id, leave null for list of boxes
21
     * @param object Containing query arguments
22
     * @return object Result of the request
23
     */
24
    public function Get($subscriptionId = null)
25
    {
26
        if (is_null($subscriptionId)) {
27
            return $this->GetClient()->Get($this->GetUrl());
28
        }
29
        return $this->GetClient()->Get($this->GetUrl()."/".$subscriptionId);
30
    }
31
32
    /**
33
     * Create new subscription
34
     * @param object Containing all the information of a subscription
35
     * @return object Result of the request
36
     */
37
    public function Create($subscription)
38
    {
39
        return $this->GetClient()->Post($this->GetUrl(), $subscription);
40
    }
41
42
    /**
43
     * Create new subscription
44
     * @param id of the subscription
45
     * @param object Containing all the information of a subscription
46
     * @return object Result of the request
47
     */
48
    public function Update($subscription)
49
    {
50
        if (!isset($subscription['subscriptionid'])) {
51
            throw new \Exception('subscription must contain subscriptionid');
52
        }
53
        return $this->GetClient()->Put($this->GetUrl()."/".$subscription['subscriptionid'], $subscription);
54
    }
55
56
    /**
57
     * Delete a subscription object by subscription id
58
     * @param string Id of the subscription
59
     * @return object Result of the request
60
     */
61
    public function Delete($subscriptionId)
62
    {
63
        return $this->GetClient()->Delete($this->GetUrl()."/".$subscriptionId);
64
    }
65
}
66