Passed
Push — master ( bce6b5...b40887 )
by Aurimas
02:19
created

NonCacheableClosure::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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