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.
Test Setup Failed
Push — master ( e039e4...016889 )
by Gabriel
04:43
created

OperationsTrait::size()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Collections\Traits;
4
5
use Traversable;
6
7
/**
8
 * Class OperationsTrait
9
 * @package Nip\Collections\Traits
10
 */
11
trait OperationsTrait
12
{
13
14
    /**
15
     * Returns the number of parameters.
16
     *
17
     * @return int The number of parameters
18
     */
19
    public function count()
20
    {
21
        return count($this->items);
0 ignored issues
show
Bug introduced by
The property items does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
    }
23
24
    /**
25
     * Returns number of items in $collection.
26
     *
27
     * @return int
28
     */
29
    function size()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
30
    {
31
        $result = 0;
32
        foreach ($this as $value) {
0 ignored issues
show
Bug introduced by
The expression $this of type this<Nip\Collections\Traits\OperationsTrait> is not traversable.
Loading history...
33
            $result++;
34
        }
35
        return $result;
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function isEmpty()
42
    {
43
        return $this->count() < 1;
44
    }
45
46
    /**
47
     * @return bool
48
     */
49
    public function isNotEmpty()
50
    {
51
        return !$this->isEmpty();
52
    }
53
}
54