Closure::fromCallable()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bavix\Helpers;
4
5
class Closure
6
{
7
8
    public static function fromCallable($callable): \Closure
9
    {
10
        if (\version_compare(PHP_VERSION, '7.1.0') >= 0)
11
        {
12
            return \Closure::fromCallable($callable);
13
        }
14
15
        return function (...$args) use ($callable) {
16
            return $callable(...$args);
17
        };
18
    }
19
20
}
21