Watcher::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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