Watcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\HomeostasisBundle\Log;
5
6
use Innmind\LogReader\Log;
7
8
final class Watcher
9
{
10
    private $levels;
11
12 8
    public function __construct(string ...$levels)
13
    {
14 8
        $this->levels = $levels;
15 8
    }
16
17 6
    public function __invoke(Log $line): bool
18
    {
19 6
        return $line->attributes()->contains('level') && in_array(
20 4
            $line->attributes()->get('level')->value(),
21 4
            $this->levels,
22 6
            true
23
        );
24
    }
25
}
26