Closure   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 12
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromCallable() 0 9 2
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