Passed
Push — master ( 2c97eb...c298b6 )
by Petr
02:20
created

TClock::getClocks()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
namespace kalanis\kw_cache_psr\Traits;
4
5
6
use kalanis\kw_cache_psr\Adapters\PoolClock;
7
use Psr\Clock\ClockInterface;
8
9
10
/**
11
 * Trait TClock
12
 * @package kalanis\kw_cache_psr\Traits
13
 * Process clocks
14
 */
15
trait TClock
16
{
17
    protected ?ClockInterface $clock = null;
18
19 10
    public function initTClock(?ClockInterface $clock): void
20
    {
21 10
        $this->clock = $clock;
22 10
    }
23
24 2
    public function getClocks(): ClockInterface
25
    {
26 2
        return $this->clock ?: new PoolClock();
27
    }
28
}
29