Passed
Push — master ( b4b355...41732f )
by Бабичев
02:43
created

Closure::fromCallable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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