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.

DelegatingRenderer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 5 1
A __construct() 0 3 1
A getRenderer() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusReportPlugin\Renderer;
6
7
use InvalidArgumentException;
8
use Odiseo\SyliusReportPlugin\DataFetcher\Data;
9
use Odiseo\SyliusReportPlugin\Model\ReportInterface;
10
use Sylius\Component\Registry\ServiceRegistryInterface;
11
12
/**
13
 * @author Mateusz Zalewski <[email protected]>
14
 * @author Diego D'amico <[email protected]>
15
 * @author Rimas Kudelis <[email protected]>
16
 */
17
class DelegatingRenderer implements DelegatingRendererInterface
18
{
19
    /**
20
     * Renderer registry.
21
     */
22
    protected ServiceRegistryInterface $registry;
23
24
    public function __construct(ServiceRegistryInterface $registry)
25
    {
26
        $this->registry = $registry;
27
    }
28
29
    public function render(ReportInterface $report, Data $data): string
30
    {
31
        $renderer = $this->getRenderer($report);
32
33
        return $renderer->render($report, $data);
34
    }
35
36
    public function getRenderer(ReportInterface $report): RendererInterface
37
    {
38
        /** @var RendererInterface $renderer */
39
        $renderer = $this->registry->get($report->getRenderer());
40
41
        return $renderer;
42
    }
43
}
44