-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefinitionContainerInterface.php
More file actions
75 lines (65 loc) · 2.22 KB
/
Copy pathDefinitionContainerInterface.php
File metadata and controls
75 lines (65 loc) · 2.22 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
<?php
declare(strict_types=1);
namespace Cake\Container;
use Cake\Container\Definition\DefinitionInterface;
use Cake\Container\Inflector\InflectorInterface;
use Cake\Container\ServiceProvider\ServiceProviderInterface;
use Psr\Container\ContainerInterface;
interface DefinitionContainerInterface extends ContainerInterface
{
/**
* @param string $id
* @param mixed $concrete
* @return \Cake\Container\Definition\DefinitionInterface
*/
public function add(string $id, mixed $concrete = null): DefinitionInterface;
/**
* Add multiple definitions at once.
*
* Supports multiple formats:
* - `[Foo::class]` - class name as value, registers as itself
* - `['alias' => Foo::class]` - alias as key, class as value
* - `[Foo::class => [Bar::class]]` - class with constructor arguments
*
* @param array<int|string, array<class-string>|class-string> $definitions
* @return self
*/
public function addDefinitions(array $definitions): self;
/**
* @param \Cake\Container\ServiceProvider\ServiceProviderInterface $provider
* @return self
*/
public function addServiceProvider(ServiceProviderInterface $provider): self;
/**
* @param string $id
* @param mixed $concrete
* @return \Cake\Container\Definition\DefinitionInterface
*/
public function addShared(string $id, mixed $concrete = null): DefinitionInterface;
/**
* @param string $id
* @return \Cake\Container\Definition\DefinitionInterface
*/
public function extend(string $id): DefinitionInterface;
/**
* @param mixed $id
* @return mixed
*/
public function getNew(mixed $id): mixed;
/**
* Check if the container has a registered definition for the given id.
*
* Unlike `has()`, this only checks explicit definitions, not service providers
* or delegate containers.
*
* @param string $id
* @return bool
*/
public function hasDefinition(string $id): bool;
/**
* @param string $type
* @param callable|null $callback
* @return \Cake\Container\Inflector\InflectorInterface
*/
public function inflector(string $type, ?callable $callback = null): InflectorInterface;
}