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.

Task::complete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Ciromattia\Teamwork;
4
5
use Ciromattia\Teamwork\Traits\TimeTrait;
6
use Ciromattia\Teamwork\Traits\RestfulTrait;
7
8
class Task extends TeamworkObject
9
{
10
    use RestfulTrait, TimeTrait;
11
12
    protected $wrapper = 'task';
13
    protected $endpoint = 'tasks';
14
15
    /**
16
     * Get All Tasks
17
     * GET /tasks.json
18
     *
19
     * @param null $args
20
     *
21
     * @return mixed
22
     */
23
    public function all($args = null)
24
    {
25
        $this->areArgumentsValid($args, ['filter', 'page', 'pageSize', 'startdate', 'enddate', 'updatedAfterDate', 'completedAfterDate', 'completedBeforeDate', 'showDeleted', 'includeCompletedTasks', 'includeCompletedSubtasks', 'creator-ids', 'include', 'responsible-party-ids', 'sort', 'getSubTasks', 'nestSubTasks', 'getFiles', 'dataSet', 'includeToday', 'ignore-start-date']);
0 ignored issues
show
Documentation introduced by
$args is of type null, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
26
27
        return $this->client->get($this->endpoint, $args)->response();
28
    }
29
30
    /**
31
     * Complete A Task
32
     * PUT tasks/{id}/complete.json
33
     *
34
     * @return mixed
35
     */
36
    public function complete()
37
    {
38
        return $this->client->put("$this->endpoint/$this->id/complete", [])->response();
39
    }
40
41
    /**
42
     * Uncomplete A Task
43
     * PUT tasks/{id}/uncomplete.json
44
     *
45
     * @return mixed
46
     */
47
    public function uncomplete()
48
    {
49
        return $this->client->put("$this->endpoint/$this->id/uncomplete", [])->response();
50
    }
51
52
    /**
53
     * Time Totals
54
     * GET /projects/{id}/time/total.json
55
     *
56
     * @return mixed
57
     */
58
    public function timeTotal()
59
    {
60
        return $this->client->get("$this->endpoint/$this->id/time/total")->response();
61
    }
62
63
    /**
64
     * Create Time Entry
65
     * POST /tasks/{id}/time_entries.json
66
     *
67
     * @param $data
68
     *
69
     * @return mixed
70
     */
71
    public function createTime($data)
72
    {
73
        return $this->client->post("$this->endpoint/$this->id/time_entries", ['time-entry' => $data])->response();
74
    }
75
76
    /**
77
     * Edit A Task
78
     * PUT tasks/{id}.json
79
     *
80
     * @return mixed
81
     */
82
    public function edit($args)
83
    {
84
        return $this->client->put("$this->endpoint/$this->id.json", ['todo-item' => $args])->response();
85
    }
86
}
87