CachedInterval::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Polder Knowledge / log-module (https://polderknowledge.com)
4
 *
5
 * @link https://github.com/polderknowledge/log-module for the canonical source repository
6
 * @copyright Copyright (c) 2016-2017 Polder Knowledge (https://polderknowledge.com)
7
 * @license https://github.com/polderknowledge/log-module/blob/master/LICENSE.md MIT
8
 */
9
10
namespace PolderKnowledge\LogModule\Monolog\Handler\Factory;
11
12
use PolderKnowledge\LogModule\Monolog\Handler\CachedInterval as CachedIntervalHandler;
13
use WShafer\PSR11MonoLog\FactoryInterface;
14
use WShafer\PSR11MonoLog\HandlerManagerAwareInterface;
15
use WShafer\PSR11MonoLog\HandlerManagerTrait;
16
17
final class CachedInterval implements FactoryInterface, HandlerManagerAwareInterface
18
{
19
    use HandlerManagerTrait;
20
21 6
    public function __invoke(array $options)
22
    {
23 6
        $handler = $this->getHandlerManager()->get($options['handler']);
24
25 3
        return new CachedIntervalHandler(
26 3
            $handler,
27 3
            $options['interval'] ?? 60,
28 3
            $options['store'] ?? null
29
        );
30
    }
31
}
32