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.

Channel   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 60
ccs 4
cts 16
cp 0.25
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 Channel extends Base
7
{
8
    /**
9
     * Private constructor so only the client can create this
10
     * @param Client $client
11
     */
12 16
    public function __construct(Client $client)
13
    {
14 16
        parent::__construct($client);
15 16
        $this->SetUrl("/project/" . $this->GetClient()->GetProjectId() . "/channel");
16 16
    }
17
18
    /**
19
     * Get one or multiple channels
20
     * @param string channel 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($channelId = null, $args = array("limit" => 50))
25
    {
26
        if (is_null($channelId)) {
27
            return $this->GetClient()->Get($this->getUrl(), $args);
28
        }
29
        return $this->GetClient()->Get($this->getUrl()."/".$channelId, $args);
30
    }
31
32
    /**
33
     * Create new channel
34
     * @param object Containing all the information of a channel
35
     * @return object Result of the request
36
     */
37
    public function Create($channel)
38
    {
39
        return $this->GetClient()->Post($this->getUrl(), $channel);
40
    }
41
42
    /**
43
     * Update a channel
44
     * @param string channel id
45
     * @param object Containing all the information of a channel
46
     * @return object Result of the request
47
     */
48
    public function Update($channel)
49
    {
50
        if (!isset($channel['channelid'])) {
51
            throw new \Exception("channel must contain a channelid");
52
        }
53
        return $this->GetClient()->Put($this->getUrl()."/".$channel['channelid'], $channel);
54
    }
55
56
    /**
57
     * Delete a channel object by channel id
58
     * @param string Id of the channel
59
     * @return object Result of the request
60
     */
61
    public function Delete($channelId)
62
    {
63
        return $this->GetClient()->Delete($this->getUrl()."/".$channelId);
64
    }
65
}
66