Test Failed
Push — master ( 50022e...5b6d46 )
by Radosław
02:04
created

TrampolineThunk::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Baethon\Phln;
5
6
class TrampolineThunk
7
{
8
    /**
9
     * @var \Closure
10
     */
11
    private $fn;
12
13
    public function __construct(callable $fn)
14
    {
15
        $this->fn = \Closure::fromCallable($fn)
16
            ->bindTo($this);
17
    }
18
19
    public function __invoke(...$args)
20
    {
21
        $fn = $this->fn;
22
23
        return function () use ($args, $fn) {
24
            return $fn(...$args);
25
        };
26
    }
27
}
28