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.

InformationCollectionContentsAdapter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getNbResults() 0 10 2
A getSlice() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Netgen\InformationCollection\Core\Pagination;
6
7
use Netgen\InformationCollection\API\Service\InformationCollection;
8
use Netgen\InformationCollection\API\Value\Filter\Query;
9
10
class InformationCollectionContentsAdapter extends BaseAdapter
11
{
12
    /**
13
     * @var \Netgen\InformationCollection\API\Value\Filter\Query
14
     */
15
    protected $query;
16
17
    public function __construct(InformationCollection $informationCollectionService, Query $query)
18
    {
19
        $this->query = $query;
20
        parent::__construct($informationCollectionService);
21
    }
22
23
    public function getNbResults()
24
    {
25
        if (!isset($this->nbResults)) {
26
            $this->nbResults = $this->informationCollectionService
27
                ->getObjectsWithCollectionsCount()
28
                ->getCount();
29
        }
30
31
        return $this->nbResults;
32
    }
33
34
    public function getSlice($offset, $length)
35
    {
36
        $query = new Query($offset, $length);
37
38
        $objects = $this->informationCollectionService
39
            ->getObjectsWithCollections($query)
40
            ->getContents();
41
42
        $this->getNbResults();
43
44
        return $objects;
45
    }
46
}
47