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 ( 14ab12...ed0ed3 )
by Nico
05:48
created

NextBestAction::Assign()   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 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
namespace Datatrics\API\Modules;
3
4
use Datatrics\API\Client;
5
6
class NextBestAction extends Base
7
{
8
    /**
9
     * Private constructor so only the client can create this
10
     * @param Client $client
11
     */
12 20
    public function __construct(Client $client)
13
    {
14 20
        parent::__construct($client);
15 20
        $this->SetUrl("/project/" . $this->GetClient()->GetProjectId() . "/nextbestaction");
16 20
    }
17
18
    /**
19
     * Get one or multiple nextbestactions
20
     * @param string nextbestaction 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($nextbestactionId = null, $args = array("limit" => 50))
25
    {
26
        if (is_null($nextbestactionId)) {
27
            return $this->GetClient()->Get($this->GetUrl(), $args);
28
        }
29
        return $this->GetClient()->Get($this->GetUrl()."/".$nextbestactionId, $args);
30
    }
31
32
    /**
33
     * Create new nextbestaction
34
     * @param object Containing all the information of a nextbestaction
35
     * @return object Result of the request
36
     */
37
    public function Create($nextbestaction)
38
    {
39
        return $this->GetClient()->Post($this->GetUrl(), $nextbestaction);
40
    }
41
42
    /**
43
     * Update a nextbestaction
44
     * @param object Containing all the information of a nextbestaction
45
     * @return object Result of the request
46
     */
47
    public function Update($nextbestaction)
48
    {
49
        if (!isset($nextbestaction['nextbestactionid'])) {
50
            throw new \Exception('nextbestaction must contain nextbestactionid');
51
        }
52
        return $this->GetClient()->Put($this->GetUrl()."/".$nextbestaction['nextbestactionid'], $nextbestaction);
53
    }
54
55
    /**
56
     * Delete a nextbestaction object by nextbestaction id
57
     * @param string Id of the nextbestaction
58
     * @return object Result of the request
59
     */
60
    public function Delete($nextbestactionId)
61
    {
62
        return $this->GetClient()->Delete($this->GetUrl()."/".$nextbestactionId);
63
    }
64
65
    /**
66
     * Delete a nextbestaction object by nextbestaction id
67
     * @param string Id of the nextbestaction
68
     * @return object Result of the request
69
     */
70
    public function Schedule($nextbestactionId)
71
    {
72
        return $this->GetClient()->Put($this->GetUrl()."/".$nextbestactionId."/schedule");
73
    }
74
75
    /**
76
     * Delete a nextbestaction object by nextbestaction id
77
     * @param string Id of the nextbestaction
78
     * @return object Result of the request
79
     */
80
    public function Assign($nextbestactionId)
81
    {
82
        return $this->GetClient()->Put($this->GetUrl()."/".$nextbestactionId."/v");
83
    }
84
}
85