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 — master ( b5dfb6...a568a9 )
by Mario
40:05
created

InformationCollectionContentsAdapter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 24
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNbResults() 10 10 2

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
3
declare(strict_types=1);
4
5
namespace Netgen\InformationCollection\Core\Pagination;
6
7 View Code Duplication
class InformationCollectionContentsAdapter extends BaseAdapter
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...
8
{
9
    public function getNbResults()
10
    {
11
        if (!isset($this->nbResults)) {
12
            $this->nbResults = $this->informationCollectionService
0 ignored issues
show
Bug introduced by
The property nbResults 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...
13
                ->getObjectsWithCollections($this->getCountQuery())
14
                ->count;
15
        }
16
17
        return $this->nbResults;
18
    }
19
20
    public function getSlice($offset, $length)
21
    {
22
        $objects = $this->informationCollectionService
23
            ->getObjectsWithCollections($this->getQuery($offset, $length))
24
            ->contents;
25
26
        $this->getNbResults();
27
28
        return $objects;
29
    }
30
}
31