1: <?php
2: /**
3: * This file is part of the Autarky package.
4: *
5: * (c) Andreas Lutro <anlutro@gmail.com>
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: namespace Autarky\Container;
12:
13: /**
14: * Callable invoker interface.
15: *
16: * Type-hint against this interface if you only require to invoke callables via
17: * the container. The ContainerInterface extends this interface.
18: */
19: interface CallableInvokerInterface
20: {
21: /**
22: * Execute a function, closure or class method, resolving type-hinted
23: * arguments as necessary.
24: *
25: * Callable can be anything that passes is_callable() in PHP, including an
26: * array of ['ClassName', 'method'], in which case the class will first be
27: * resolved from the container. Callable can also be some things that don't
28: * pass is_callable(), for example ['InterfaceName', 'method'], but only if
29: * 'InterfaceName' is bound to the container somehow.
30: *
31: * @param callable $callable
32: * @param array $params See ContainerInterface::params()
33: *
34: * @return mixed
35: */
36: public function invoke($callable, array $params = array());
37: }
38: