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.

DelegatingDataFetcher::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusReportPlugin\DataFetcher;
6
7
use InvalidArgumentException;
8
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
9
use Sylius\Component\Registry\ServiceRegistryInterface;
10
11
/**
12
 * Data fetcher choice type
13
 *
14
 * @author Łukasz Chruściel <[email protected]>
15
 * @author Diego D'amico <[email protected]>
16
 */
17
class DelegatingDataFetcher implements DelegatingDataFetcherInterface
18
{
19
    /**
20
     * DataFetcher registry.
21
     */
22
    protected ServiceRegistryInterface $registry;
23
24
    public function __construct(ServiceRegistryInterface $registry)
25
    {
26
        $this->registry = $registry;
27
    }
28
29
    public function fetch(ReportInterface $report, array $configuration = []): Data
30
    {
31
        $dataFetcher = $this->getDataFetcher($report);
32
        $configuration = [] === $configuration ? $report->getDataFetcherConfiguration() : $configuration;
33
34
        return $dataFetcher->fetch($configuration);
35
    }
36
37
    public function getDataFetcher(ReportInterface $report): DataFetcherInterface
38
    {
39
        /** @var DataFetcherInterface $dataFetcher */
40
        $dataFetcher = $this->registry->get($report->getDataFetcher());
41
42
        return $dataFetcher;
43
    }
44
}
45