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

Closure   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

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