ClosureHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

1 Method

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