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

Profile   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 76
ccs 4
cts 4
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A Get() 0 7 2
A Create() 0 4 1
A Delete() 0 4 1
A Update() 0 7 2
A Bulk() 0 8 2
1
<?php
2
namespace Datatrics\API\Modules;
3
4
use Datatrics\API\Client;
5
6
class Profile 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() . "/profile");
17 11
    }
18
19
    /**
20
     * Get one or multiple profiles
21
     * @param string profile id, leave null for list of profiles
22
     * @param object Containing query arguments
23
     * @return object Result of the request
24
     */
25
    public function Get($profileId = null, $args = array("limit" => 50))
26
    {
27
        if (is_null($profileId)) {
28
            return $this->GetClient()->Get($this->GetUrl(), $args);
29
        }
30
        return $this->GetClient()->Get($this->GetUrl()."/".$profileId, $args);
31
    }
32
33
    /**
34
     * Create new profile
35
     * @param object Containing all the information of a profile
36
     * @return object Result of the request
37
     */
38
    public function Create($profile)
39
    {
40
        return $this->GetClient()->Post($this->GetUrl(), $profile);
41
    }
42
43
    /**
44
     * Delete a profile by profileid
45
     * @param string Id of the profile to be deleted
46
     * @return object Result of the request
47
     */
48
    public function Delete($profileid)
0 ignored issues
show
Unused Code introduced by
The parameter $profileid is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
    {
50
        return $this->GetClient()->Delete($this->GetUrl()."/".profileid);
51
    }
52
53
    /**
54
     * Update a profile
55
     * @param object Profile containing the profileid and fields that need to be updated
56
     * @throws \Exception When profileid is not present
57
     * @return object Result of the request
58
     */
59
    public function Update($profile)
60
    {
61
        if (!isset($profile['profileid'])) {
62
            throw new \Exception("profile must contain a profileid");
63
        }
64
        return $this->GetClient()->Post($this->GetUrl()."/".$profile['profileid'], $profile);
65
    }
66
67
    /**
68
     * Updates a maximum of 50 profiles at a time.
69
     * @param array Containing profiles with a maximum of 50
70
     * @throws \Exception When more that 50 profiles are provided
71
     * @return object Result of the request
72
     */
73
    public function Bulk($profiles)
74
    {
75
        if (count($profiles) > 50) {
76
            throw new \Exception("Maximum of 50 profiles allowed at a time");
77
        }
78
79
        return $this->GetClient()->Post($this->GetUrl()."/bulk", ['items' => $profiles]);
80
    }
81
}
82