1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace DI;
|
|
|
6 |
|
|
|
7 |
/**
|
|
|
8 |
* Describes the basic interface of a factory.
|
|
|
9 |
*
|
|
|
10 |
* @api
|
|
|
11 |
*
|
|
|
12 |
* @since 4.0
|
|
|
13 |
* @author Matthieu Napoli <matthieu@mnapoli.fr>
|
|
|
14 |
*/
|
|
|
15 |
interface FactoryInterface
|
|
|
16 |
{
|
|
|
17 |
/**
|
|
|
18 |
* Resolves an entry by its name. If given a class name, it will return a new instance of that class.
|
|
|
19 |
*
|
|
|
20 |
* @param string $name Entry name or a class name.
|
|
|
21 |
* @param array $parameters Optional parameters to use to build the entry. Use this to force specific
|
|
|
22 |
* parameters to specific values. Parameters not defined in this array will
|
|
|
23 |
* be automatically resolved.
|
|
|
24 |
*
|
|
|
25 |
* @throws \InvalidArgumentException The name parameter must be of type string.
|
|
|
26 |
* @throws DependencyException Error while resolving the entry.
|
|
|
27 |
* @throws NotFoundException No entry or class found for the given name.
|
|
|
28 |
*/
|
|
|
29 |
public function make(string $name, array $parameters = []) : mixed;
|
|
|
30 |
}
|