NonCacheableClosure   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setherator\Variables;
6
7
use Closure;
8
9
/**
10
 * @author Aurimas Niekis <[email protected]>
11
 */
12
class NonCacheableClosure
13
{
14
    private Closure $closure;
15
16 6
    public function __construct(Closure $closure)
17
    {
18 6
        $this->closure = $closure;
19 6
    }
20
21 6
    public function __invoke()
22
    {
23 6
        $closure = $this->closure;
24
25 6
        return $closure();
26
    }
27
}
28