Service   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 2
c 5
b 1
f 2
lcom 0
cbo 4
dl 0
loc 25
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A __invoke() 0 8 1
1
<?php
2
namespace Bookdown\Bookdown\Service;
3
4
class Service
5
{
6
    protected $collector;
7
    protected $processorBuilder;
8
    protected $timer;
9
10 3
    public function __construct(
11
        Collector $collector,
12
        ProcessorBuilder $processorBuilder,
13
        Timer $timer
14
    ) {
15 3
        $this->collector = $collector;
16 3
        $this->processorBuilder = $processorBuilder;
17 3
        $this->timer = $timer;
18 3
    }
19
20 1
    public function __invoke($rootConfigFile, array $rootConfigOverrides)
21
    {
22 1
        $this->collector->setRootConfigOverrides($rootConfigOverrides);
23 1
        $rootPage = $this->collector->__invoke($rootConfigFile);
24 1
        $processor = $this->processorBuilder->newProcessor($rootPage->getConfig());
25 1
        $processor->__invoke($rootPage);
0 ignored issues
show
Compatibility introduced by
$rootPage of type object<Bookdown\Bookdown\Content\Page> is not a sub-type of object<Bookdown\Bookdown\Content\RootPage>. It seems like you assume a child class of the class Bookdown\Bookdown\Content\Page to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
26 1
        $this->timer->report();
27 1
    }
28
}
29