Processor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A __invoke() 0 12 3
1
<?php
2
namespace Bookdown\Bookdown\Service;
3
4
use Psr\Log\LoggerInterface;
5
use Bookdown\Bookdown\Content\RootPage;
6
7
class Processor
8
{
9
    protected $logger;
10
    protected $processes;
11
12 3
    public function __construct(
13
        LoggerInterface $logger,
14
        array $processes
15
    ) {
16 3
        $this->logger = $logger;
17 3
        $this->processes = $processes;
18 3
    }
19
20 2
    public function __invoke(RootPage $root)
21
    {
22 2
        $this->logger->info("Processing content.");
23 2
        foreach ($this->processes as $process) {
24 2
            $this->logger->info("  Applying " . get_class($process));
25 2
            $page = $root;
26 2
            while ($page) {
27 2
                $process($page);
28 2
                $page = $page->getNext();
29 2
            }
30 2
        }
31 2
    }
32
}
33