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 ( fb4bbc...dcdbd9 )
by Nico
29:09 queued 02:20
created

Project   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 73
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 73
loc 73
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A Get() 4 4 2
A Create() 4 4 1
A Update() 4 4 1
A Delete() 4 4 1
A Fields() 4 4 1
A Logs() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Datatrics\API\Modules;
3
4 View Code Duplication
class Project extends Base
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5
{
6
    /**
7
     * Private constructor so only the client can create this
8
     * @param string $apikey
9
     */
10
    public function __construct($apikey)
11
    {
12
        parent::__construct($apikey, "/project");
13
    }
14
15
    /**
16
     * Get one or multiple projects
17
     * @param string project id, leave null for list of boxes
18
     * @param object Containing query arguments
19
     * @return object Result of the request
20
     */
21
    public function Get($projectId = null, $args = array("limit" => 50))
22
    {
23
        return $projectId == null ? $this->request(self::HTTP_GET, "?".http_build_query($args)) : $this->request(self::HTTP_GET, "/".$projectId."?".http_build_query($args));
24
    }
25
26
    /**
27
     * Create new project
28
     * @param object Containing all the information of a project
29
     * @return object Result of the request
30
     */
31
    public function Create($project)
32
    {
33
        return $this->request(self::HTTP_POST, "", $project);
34
    }
35
36
    /**
37
     * Create new project
38
     * @param id of the project
39
     * @param object Containing all the information of a project
40
     * @return object Result of the request
41
     */
42
    public function Update($projectId, $project)
43
    {
44
        return $this->request(self::HTTP_PUT, "/".$projectId, $project);
45
    }
46
47
    /**
48
     * Delete a project object by project id
49
     * @param string Id of the project
50
     * @return object Result of the request
51
     */
52
    public function Delete($projectId)
53
    {
54
        return $this->request(self::HTTP_DELETE, "/".$projectId);
55
    }
56
57
    /**
58
     * Retrieve fields of a project object by project id
59
     * @param string Id of the project
60
     * @return object Result of the request
61
     */
62
    public function Fields($projectId)
63
    {
64
        return $this->request(self::HTTP_GET, "/".$projectId."/fields");
65
    }
66
67
    /**
68
     * Retrieve logs of a project object by project id
69
     * @param string Id of the project
70
     * @return object Result of the request
71
     */
72
    public function Logs($projectId)
73
    {
74
        return $this->request(self::HTTP_GET, "/".$projectId."/logs");
75
    }
76
}
77