ClosureHandler::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Tleckie\Di\Definition\Handler;
4
5
use Closure;
6
7
/**
8
 * Class ClosureHandler
9
 *
10
 * @package Tleckie\Di\Handler\Handler
11
 * @author  Teodoro Leckie Westberg <[email protected]>
12
 */
13
class ClosureHandler extends Handler
14
{
15
    /**
16
     * @param $value
17
     * @return mixed
18
     */
19
    public function handle($value): mixed
20
    {
21
        if ($value instanceof Closure) {
22
            return $value();
23
        }
24
25
        return parent::handle($value);
26
    }
27
}
28