PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.2
Pods – Custom Content Types and Fields v3.2.2
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Container / Container_Interface.php
pods / src / Pods / Container Last commit date
Container_DI52.php 2 years ago Container_Interface.php 2 years ago
Container_Interface.php
69 lines
1 <?php
2
3 namespace Pods\Container;
4
5 /**
6 * Describes the interface of a container that exposes methods to read its entries.
7 *
8 * @credit The StellarWP team - https://github.com/stellarwp/container-contract
9 *
10 * @since 3.0
11 */
12 interface Container_Interface {
13 /**
14 * Binds an interface, a class or a string slug to an implementation.
15 *
16 * Existing implementations are replaced.
17 *
18 * @since 3.0
19 *
20 * @param string|class-string $id Identifier of the entry to look for.
21 * @param mixed $implementation The implementation that should be bound to the alias(es); can be a
22 * class name, an object or a closure.
23 *
24 * @return void
25 */
26 public function bind( string $id, $implementation = null );
27
28 /**
29 * Finds an entry of the container by its identifier and returns it.
30 *
31 * @since 3.0
32 *
33 * @template T
34 *
35 * @param string|class-string<T> $id Identifier of the entry to look for.
36 *
37 * @return ($id is class-string<T> ? T : mixed) Entry.
38 */
39 public function get( string $id );
40
41 /**
42 * Returns true if the container can return an entry for the given identifier.
43 * Returns false otherwise.
44 *
45 * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
46 * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.
47 *
48 * @since 3.0
49 *
50 * @param string|class-string $id Identifier of the entry to look for.
51 *
52 * @return bool
53 */
54 public function has( string $id );
55
56 /**
57 * Binds an interface a class or a string slug to an implementation and will always return the same instance.
58 *
59 * @since 3.0
60 *
61 * @param string|class-string $id Identifier of the entry to look for.
62 * @param mixed $implementation The implementation that should be bound to the alias(es); can be a
63 * class name, an object or a closure.
64 *
65 * @return void This method does not return any value.
66 */
67 public function singleton( string $id, $implementation = null );
68 }
69