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 — 2.0 ( 5e7ce8...036b94 )
by Nico
06:29
created

Campaign::DeleteLane()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
namespace Datatrics\API\Modules;
3
4
use Datatrics\API\Client;
5
6
class Campaign extends Base
7
{
8
    /**
9
     * Private constructor so only the client can create this
10
     * @param string $apikey
0 ignored issues
show
Bug introduced by
There is no parameter named $apikey. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
11
     * @param string $projectid
0 ignored issues
show
Bug introduced by
There is no parameter named $projectid. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
12
     */
13 11
    public function __construct(Client $client)
14
    {
15 11
        parent::__construct($client);
16 11
        $this->SetUrl("/project/" . $this->GetClient()->GetProjectId() . "/campaign");
17 11
    }
18
19
    /**
20
     * Get one or multiple campaigns
21
     * @param string campaign id, leave null for list of campaigns
22
     * @param object Containing query arguments
23
     * @return object Result of the request
24
     */
25
    public function Get($campaignId = null, $args = array("limit" => 50))
26
    {
27
        if (is_null($campaignId)) {
28
            return $this->GetClient()->Get($this->GetUrl(), $args);
29
        }
30
        return $this->GetClient()->Get($this->GetUrl()."/".$campaignId, $args);
31
    }
32
33
    /**
34
     * Get one or multiple lanes
35
     * @param string campaign id
36
     * @param string lane id, leave null for list of lanes
37
     * @param object Containing query arguments
38
     * @return object Result of the request
39
     */
40
    public function GetLane($campaignId, $laneId = null, $args = array("limit" => 50))
41
    {
42
        if (is_null($laneId)) {
43
            return $this->GetClient()->Get($this->GetUrl()."/".$campaignId."/lane", $args);
44
        }
45
        return $this->GetClient()->Get($this->GetUrl()."/".$campaignId."/lane/".$laneId, $args);
46
    }
47
48
    /**
49
     * Create new campaign
50
     * @param object Containing all the information of a lane
51
     * @return object Result of the request
52
     */
53
    public function Create($campaign)
54
    {
55
        return $this->GetClient()->Post($this->GetUrl(), $campaign);
56
    }
57
58
    /**
59
     * Create new lane
60
     * @param string campaign id
61
     * @param object Containing all the information of a lane
62
     * @return object Result of the request
63
     */
64
    public function CreateLane($campaignId, $lane)
65
    {
66
        return $this->GetClient()->Post($this->GetUrl()."/".$campaignId."/lane", $lane);
67
    }
68
69
    /**
70
     * Update a campaign
71
     * @param object campaign containing the campaign id and fields that need to be updated
72
     * @throws \Exception When boxid is not present
73
     * @return object Result of the request
74
     */
75
    public function Update($campaign)
76
    {
77
        if (!isset($campaign['campaignid'])) {
78
            throw new \Exception("campaign must contain a campaignid");
79
        }
80
        return $this->GetClient()->Put($this->GetUrl()."/".$campaign['campaignid'], $campaign);
81
    }
82
83
    /**
84
     * Update a lane
85
     * @param string Id of the campaign
86
     * @param object lane containing the laneid and fields that need to be updated
87
     * @throws \Exception When boxid is not present
88
     * @return object Result of the request
89
     */
90
    public function UpdateLane($campaignId, $lane)
91
    {
92
        if (!isset($lane['laneid'])) {
93
            throw new \Exception("lane must contain a laneid");
94
        }
95
        return $this->GetClient()->Put($this->GetUrl()."/".$campaignId."/lane/".$lane['laneid'], $lane);
96
    }
97
98
    /**
99
     * Delete a campaign object by campaign id
100
     * @param string Id of the campaign
101
     * @return object Result of the request
102
     */
103
    public function Delete($campaignId)
104
    {
105
        return $this->GetClient()->Delete($this->GetUrl()."/".$campaignId);
106
    }
107
108
    /**
109
     * Delete a campaign object by campaign id
110
     * @param string Id of the campaign
111
     * @return object Result of the request
112
     */
113
    public function DeleteLane($campaignId, $laneId)
114
    {
115
        return $this->GetClient()->Delete($this->GetUrl()."/".$campaignId."/lane/".$laneId);
116
    }
117
118
    /**
119
     * Retrieve stats of a lane by campaign
120
     * @param string Id of the campaign
121
     * @return object Result of the request
122
     */
123
    public function Stats($campaignId)
124
    {
125
        return $this->GetClient()->Get($this->GetUrl()."/".$campaignId."/stats");
126
    }
127
128
    /**
129
     * Retrieve stats of a lane by campaign and lane id
130
     * @param string Id of the campaign
131
     * @param string Id of the lane to be deleted
132
     * @return object Result of the request
133
     */
134
    public function StatsLane($campaignId, $laneId)
135
    {
136
        return $this->GetClient()->Get($this->GetUrl()."/".$campaignId."/lane/".$laneId."/stats");
137
    }
138
}
139