Completed
Push — master ( 44b412...e96d03 )
by Andrey
02:04
created

CallableItem::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Borodulin\Container\Autowire\Item;
6
7
use Borodulin\Container\Autowire\AutowireItemInterface;
8
9
class CallableItem implements AutowireItemInterface
10
{
11
    /**
12
     * @var callable
13
     */
14
    private $callable;
15
16 3
    public function __construct(callable $callable)
17
    {
18 3
        $this->callable = $callable;
19 3
    }
20
21 1
    public function serialize(): string
22
    {
23 1
        return \Opis\Closure\serialize($this->callable);
24
    }
25
26
    /**
27
     * @param string $serialized
28
     */
29 1
    public function unserialize($serialized): void
30
    {
31 1
        $this->callable = \Opis\Closure\unserialize($serialized);
32 1
    }
33
34 2
    public function getCallable(): callable
35
    {
36 2
        return $this->callable;
37
    }
38
}
39