a4358b15bae4857ee1581c413bed15ade42aa769
[GitHub/WoltLab/WCF.git] /
1 <?php
2 /**
3 * PHP-DI
4 *
5 * @link http://mnapoli.github.com/PHP-DI/
6 * @copyright Matthieu Napoli (http://mnapoli.fr/)
7 * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
8 */
9
10 namespace DI\Definition\Resolver;
11
12 use DI\Definition\Definition;
13 use DI\Definition\Exception\DefinitionException;
14
15 /**
16 * Resolves a definition to a value.
17 *
18 * @since 4.0
19 * @author Matthieu Napoli <matthieu@mnapoli.fr>
20 */
21 interface DefinitionResolver
22 {
23 /**
24 * Resolve a definition to a value.
25 *
26 * @param Definition $definition Object that defines how the value should be obtained.
27 * @param array $parameters Optional parameters to use to build the entry.
28 *
29 * @throws DefinitionException If the definition cannot be resolved.
30 *
31 * @return mixed Value obtained from the definition.
32 */
33 public function resolve(Definition $definition, array $parameters = []);
34
35 /**
36 * Check if a definition can be resolved.
37 *
38 * @param Definition $definition Object that defines how the value should be obtained.
39 * @param array $parameters Optional parameters to use to build the entry.
40 *
41 * @return bool
42 */
43 public function isResolvable(Definition $definition, array $parameters = []);
44 }