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
Pull Request — master (#20)
by
unknown
03:21
created

Notification   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 49
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A endpoint() 0 4 1
A getNotificationItem() 0 4 1
A setNotificationItem() 0 4 1
A removeNotificationItem() 0 4 1
1
<?php
2
3
namespace Vindi;
4
5
class Notification extends Resource
6
{
7
    /**
8
     * The endpoint that will hit the API.
9
     *
10
     * @return string
11
     */
12
    public function endpoint()
13
    {
14
        return 'notification';
15
    }
16
17
    /**
18
     * Make a GET request to notifications/{id}/notification_items.
19
     * @param int $id The resource's id.
20
     *
21
     * @return string
22
     */
23
    public function getNotificationItem($id, $page = 1, $per_page = 50)
24
    {
25
        return $this->get($id, 'notification_items', $page, $per_page);
0 ignored issues
show
Unused Code introduced by
The call to Notification::get() has too many arguments starting with $page.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26
    }
27
28
    /**
29
     * Make a POST request to notifications/{id}/notification_items.
30
     *
31
     * @param int   $id The resource's id.
32
     * @param array.
33
     *
34
     * @return mixed
35
     */
36
    public function setNotificationItem($id, array $form_params = [])
37
    {
38
        return $this->post($id, 'notification_items', $form_params);
39
    }
40
41
    /**
42
     * Make a DELETE request to notifications/{id}/notification_items.
43
     *
44
     * @param int   $id The resource's id.
45
     * @param int 	$item_id The resource's item id.
0 ignored issues
show
Documentation introduced by
There is no parameter named $item_id. Did you maybe mean $item_Id?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
46
     *
47
     * @return mixed
48
     */
49
    public function removeNotificationItem($id, $item_Id)
0 ignored issues
show
Unused Code introduced by
The parameter $item_Id 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...
50
    {
51
        return $this->delete($id, 'notification_items', $item_id);
0 ignored issues
show
Bug introduced by
The variable $item_id does not exist. Did you mean $item_Id?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
Documentation introduced by
'notification_items' is of type string, 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...
Unused Code introduced by
The call to Notification::delete() has too many arguments starting with $item_id.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
52
    }
53
}
54