Total Complexity | 4 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Callback implements ReferenceInterface { |
||
14 | /** |
||
15 | * @var callable $callback |
||
16 | */ |
||
17 | private $callback; |
||
18 | |||
19 | /** |
||
20 | * Construct a new instance of the {@link Callback} class. |
||
21 | * |
||
22 | * @param callable $callback The callback of the reference. |
||
23 | */ |
||
24 | 2 | public function __construct(callable $callback) { |
|
26 | 2 | } |
|
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | 1 | public function resolve(Container $container, $instance = null) { |
|
32 | 1 | return call_user_func($this->callback, $container, $instance); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * Get the callback. |
||
37 | * |
||
38 | * @return callable Returns the callback. |
||
39 | */ |
||
40 | 1 | public function getCallback() { |
|
41 | 1 | return $this->callback; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Set the callback. |
||
46 | * |
||
47 | * @param callable $callback The new callback to set. |
||
48 | * @return Callback Returns `$this` for fluent calls. |
||
49 | */ |
||
50 | 1 | public function setCallback($callback) { |
|
53 | } |
||
54 | } |
||
55 |