FnDefinition::getConcrete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Habemus\Definition\Build;
5
6
use Closure;
7
use Habemus\Definition\Definition;
8
use Habemus\Definition\Identifiable\IdentifiableTrait;
9
use Habemus\Definition\MethodCall\CallableMethod;
10
use Habemus\Definition\MethodCall\CallableMethodTrait;
11
use Habemus\Definition\Sharing\Shareable;
12
use Habemus\Definition\Sharing\ShareableTrait;
13
use Habemus\Definition\Tag\Taggable;
14
use Habemus\Definition\Tag\TaggableTrait;
15
use Psr\Container\ContainerInterface;
16
17
class FnDefinition implements Definition, Shareable, CallableMethod, Taggable
18
{
19
    use IdentifiableTrait;
20
    use ShareableTrait;
21
    use CallableMethodTrait;
22
    use TaggableTrait;
23
24
    /**
25
     * @var Closure
26
     */
27
    protected $fn;
28
29
    public function __construct(Closure $fn)
30
    {
31
        $this->fn = $fn;
32
        $this->setShared(false);
33
    }
34
35
    public function getConcrete(ContainerInterface $container)
36
    {
37
        return ($this->fn)($container);
38
    }
39
}
40