Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace DI\Definition\Resolver;
6
 
7
use DI\Definition\Definition;
8
use DI\Definition\Exception\InvalidDefinition;
9
use DI\DependencyException;
10
 
11
/**
12
 * Resolves a definition to a value.
13
 *
14
 * @since 4.0
15
 * @author Matthieu Napoli <matthieu@mnapoli.fr>
16
 *
17
 * @template T of Definition
18
 */
19
interface DefinitionResolver
20
{
21
    /**
22
     * Resolve a definition to a value.
23
     *
24
     * @param Definition $definition Object that defines how the value should be obtained.
25
     * @psalm-param T $definition
26
     * @param array      $parameters Optional parameters to use to build the entry.
27
     * @return mixed Value obtained from the definition.
28
     *
29
     * @throws InvalidDefinition If the definition cannot be resolved.
30
     * @throws DependencyException
31
     */
32
    public function resolve(Definition $definition, array $parameters = []) : mixed;
33
 
34
    /**
35
     * Check if a definition can be resolved.
36
     *
37
     * @param Definition $definition Object that defines how the value should be obtained.
38
     * @psalm-param T $definition
39
     * @param array      $parameters Optional parameters to use to build the entry.
40
     */
41
    public function isResolvable(Definition $definition, array $parameters = []) : bool;
42
}