-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerInterface.php
More file actions
80 lines (70 loc) · 2.42 KB
/
ContainerInterface.php
File metadata and controls
80 lines (70 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php declare(strict_types=1);
namespace Phact\Container;
use Phact\Container\Definition\DefinitionInterface;
use Phact\Container\Exceptions\DuplicateNameException;
use Phact\Container\Inflection\InflectionInterface;
use Psr\Container\ContainerInterface as PsrContainerInterface;
interface ContainerInterface extends InvokableContainerInterface
{
/**
* Add definition by class name
*
* @param string $name
* @param string $class
* @return DefinitionInterface
* @throws DuplicateNameException If service with provided name already defined
*/
public function addDefinitionClass(string $name, string $class): DefinitionInterface;
/**
* Add definition by DefinitionInterface object
*
* @param string $name
* @param DefinitionInterface $definition
* @return DefinitionInterface
* @throws DuplicateNameException If service with provided name already defined
*/
public function addDefinition(string $name, DefinitionInterface $definition): DefinitionInterface;
/**
* Add scalar value to container
*
* @param string $name
* @param $value
*/
public function addScalar(string $name, $value): void;
/**
* When requesting an object of a certain class, the object will be returned by the corresponding name
*
* @param string $name
* @param string $class
*/
public function addReference(string $name, string $class): void;
/**
* Add aliases of the service name
*
* @param string $name
* @param array $aliases
*/
public function addAliases(string $name, array $aliases = []): void;
/**
* Add alias of the service name
*
* @param string $name
* @param string $alias
*/
public function addAlias(string $name, string $alias): void;
/**
* Add inflection to container
*
* @param InflectionInterface $inflection
* @return InflectionInterface
*/
public function addInflection(InflectionInterface $inflection): InflectionInterface;
/**
* Append sub-container to retrieve services if it cannot be resolved with current container
*
* @param PsrContainerInterface $container
* @param bool $applyInflection Apply inflection of current container to all services from delegate container
* @return mixed
*/
public function addDelegate(PsrContainerInterface $container, bool $applyInflection = true): void;
}