1 | <?php |
||
47 | trait ContainerMagicTrait |
||
48 | { |
||
49 | /** |
||
50 | * Extends an object definition. |
||
51 | * |
||
52 | * Useful when you want to extend an existing object definition, |
||
53 | * without necessarily loading that object. |
||
54 | * |
||
55 | * @param string|int $id The unique identifier for the object |
||
56 | * @param callable $callable A service definition to extend the original |
||
57 | * |
||
58 | * @return callable The wrapped callable |
||
59 | * |
||
60 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
||
61 | */ |
||
62 | public function extend($id, callable $callable): callable |
||
80 | /** |
||
81 | * Marks a callable as being a factory service. |
||
82 | * |
||
83 | * @param callable $callable A service definition to be used as a factory |
||
84 | * |
||
85 | * @return callable The passed callable |
||
86 | */ |
||
87 | public function factory(callable $callable): callable |
||
93 | /** |
||
94 | * Returns all defined value names. |
||
95 | * |
||
96 | * @return array An array of value names |
||
97 | */ |
||
98 | public function keys(): array |
||
102 | /** |
||
103 | * Protects a callable from being interpreted as a service. |
||
104 | * |
||
105 | * This is useful when you want to store a callable as a parameter. |
||
106 | * |
||
107 | * @param callable $callable A callable to protect from being evaluated |
||
108 | * |
||
109 | * @return callable The passed callable |
||
110 | * |
||
111 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
||
112 | */ |
||
113 | public function protect(callable $callable): callable |
||
119 | /** |
||
120 | * Gets a parameter or the closure defining an object. |
||
121 | * |
||
122 | * @param string $id The unique identifier for the parameter or object |
||
123 | * |
||
124 | * @return mixed The value of the parameter or the closure defining an object |
||
125 | * |
||
126 | * @throws \InvalidArgumentException if the identifier is not defined |
||
127 | */ |
||
128 | public function raw(string $id) |
||
138 | } |
||
139 |