1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,174 +0,0 @@ |
1 |
-<?php |
|
2 |
- |
|
3 |
-namespace Illuminate\Contracts\Container; |
|
4 |
- |
|
5 |
-use Closure; |
|
6 |
-use Psr\Container\ContainerInterface; |
|
7 |
- |
|
8 |
-interface Container extends ContainerInterface |
|
9 |
-{ |
|
10 |
- /** |
|
11 |
- * Determine if the given abstract type has been bound. |
|
12 |
- * |
|
13 |
- * @param string $abstract |
|
14 |
- * @return bool |
|
15 |
- */ |
|
16 |
- public function bound($abstract); |
|
17 |
- |
|
18 |
- /** |
|
19 |
- * Alias a type to a different name. |
|
20 |
- * |
|
21 |
- * @param string $abstract |
|
22 |
- * @param string $alias |
|
23 |
- * @return void |
|
24 |
- * |
|
25 |
- * @throws \LogicException |
|
26 |
- */ |
|
27 |
- public function alias($abstract, $alias); |
|
28 |
- |
|
29 |
- /** |
|
30 |
- * Assign a set of tags to a given binding. |
|
31 |
- * |
|
32 |
- * @param array|string $abstracts |
|
33 |
- * @param array|mixed ...$tags |
|
34 |
- * @return void |
|
35 |
- */ |
|
36 |
- public function tag($abstracts, $tags); |
|
37 |
- |
|
38 |
- /** |
|
39 |
- * Resolve all of the bindings for a given tag. |
|
40 |
- * |
|
41 |
- * @param string $tag |
|
42 |
- * @return iterable |
|
43 |
- */ |
|
44 |
- public function tagged($tag); |
|
45 |
- |
|
46 |
- /** |
|
47 |
- * Register a binding with the container. |
|
48 |
- * |
|
49 |
- * @param string $abstract |
|
50 |
- * @param \Closure|string|null $concrete |
|
51 |
- * @param bool $shared |
|
52 |
- * @return void |
|
53 |
- */ |
|
54 |
- public function bind($abstract, $concrete = null, $shared = false); |
|
55 |
- |
|
56 |
- /** |
|
57 |
- * Register a binding if it hasn't already been registered. |
|
58 |
- * |
|
59 |
- * @param string $abstract |
|
60 |
- * @param \Closure|string|null $concrete |
|
61 |
- * @param bool $shared |
|
62 |
- * @return void |
|
63 |
- */ |
|
64 |
- public function bindIf($abstract, $concrete = null, $shared = false); |
|
65 |
- |
|
66 |
- /** |
|
67 |
- * Register a shared binding in the container. |
|
68 |
- * |
|
69 |
- * @param string $abstract |
|
70 |
- * @param \Closure|string|null $concrete |
|
71 |
- * @return void |
|
72 |
- */ |
|
73 |
- public function singleton($abstract, $concrete = null); |
|
74 |
- |
|
75 |
- /** |
|
76 |
- * "Extend" an abstract type in the container. |
|
77 |
- * |
|
78 |
- * @param string $abstract |
|
79 |
- * @param \Closure $closure |
|
80 |
- * @return void |
|
81 |
- * |
|
82 |
- * @throws \InvalidArgumentException |
|
83 |
- */ |
|
84 |
- public function extend($abstract, Closure $closure); |
|
85 |
- |
|
86 |
- /** |
|
87 |
- * Register an existing instance as shared in the container. |
|
88 |
- * |
|
89 |
- * @param string $abstract |
|
90 |
- * @param mixed $instance |
|
91 |
- * @return mixed |
|
92 |
- */ |
|
93 |
- public function instance($abstract, $instance); |
|
94 |
- |
|
95 |
- /** |
|
96 |
- * Add a contextual binding to the container. |
|
97 |
- * |
|
98 |
- * @param string $concrete |
|
99 |
- * @param string $abstract |
|
100 |
- * @param \Closure|string $implementation |
|
101 |
- * @return void |
|
102 |
- */ |
|
103 |
- public function addContextualBinding($concrete, $abstract, $implementation); |
|
104 |
- |
|
105 |
- /** |
|
106 |
- * Define a contextual binding. |
|
107 |
- * |
|
108 |
- * @param string|array $concrete |
|
109 |
- * @return \Illuminate\Contracts\Container\ContextualBindingBuilder |
|
110 |
- */ |
|
111 |
- public function when($concrete); |
|
112 |
- |
|
113 |
- /** |
|
114 |
- * Get a closure to resolve the given type from the container. |
|
115 |
- * |
|
116 |
- * @param string $abstract |
|
117 |
- * @return \Closure |
|
118 |
- */ |
|
119 |
- public function factory($abstract); |
|
120 |
- |
|
121 |
- /** |
|
122 |
- * Flush the container of all bindings and resolved instances. |
|
123 |
- * |
|
124 |
- * @return void |
|
125 |
- */ |
|
126 |
- public function flush(); |
|
127 |
- |
|
128 |
- /** |
|
129 |
- * Resolve the given type from the container. |
|
130 |
- * |
|
131 |
- * @param string $abstract |
|
132 |
- * @param array $parameters |
|
133 |
- * @return mixed |
|
134 |
- * |
|
135 |
- * @throws \Illuminate\Contracts\Container\BindingResolutionException |
|
136 |
- */ |
|
137 |
- public function make($abstract, array $parameters = []); |
|
138 |
- |
|
139 |
- /** |
|
140 |
- * Call the given Closure / class@method and inject its dependencies. |
|
141 |
- * |
|
142 |
- * @param callable|string $callback |
|
143 |
- * @param array $parameters |
|
144 |
- * @param string|null $defaultMethod |
|
145 |
- * @return mixed |
|
146 |
- */ |
|
147 |
- public function call($callback, array $parameters = [], $defaultMethod = null); |
|
148 |
- |
|
149 |
- /** |
|
150 |
- * Determine if the given abstract type has been resolved. |
|
151 |
- * |
|
152 |
- * @param string $abstract |
|
153 |
- * @return bool |
|
154 |
- */ |
|
155 |
- public function resolved($abstract); |
|
156 |
- |
|
157 |
- /** |
|
158 |
- * Register a new resolving callback. |
|
159 |
- * |
|
160 |
- * @param \Closure|string $abstract |
|
161 |
- * @param \Closure|null $callback |
|
162 |
- * @return void |
|
163 |
- */ |
|
164 |
- public function resolving($abstract, Closure $callback = null); |
|
165 |
- |
|
166 |
- /** |
|
167 |
- * Register a new after resolving callback. |
|
168 |
- * |
|
169 |
- * @param \Closure|string $abstract |
|
170 |
- * @param \Closure|null $callback |
|
171 |
- * @return void |
|
172 |
- */ |
|
173 |
- public function afterResolving($abstract, Closure $callback = null); |
|
174 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,174 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace Illuminate\Contracts\Container; |
|
4 |
+ |
|
5 |
+use Closure; |
|
6 |
+use Psr\Container\ContainerInterface; |
|
7 |
+ |
|
8 |
+interface Container extends ContainerInterface |
|
9 |
+{ |
|
10 |
+ /** |
|
11 |
+ * Determine if the given abstract type has been bound. |
|
12 |
+ * |
|
13 |
+ * @param string $abstract |
|
14 |
+ * @return bool |
|
15 |
+ */ |
|
16 |
+ public function bound($abstract); |
|
17 |
+ |
|
18 |
+ /** |
|
19 |
+ * Alias a type to a different name. |
|
20 |
+ * |
|
21 |
+ * @param string $abstract |
|
22 |
+ * @param string $alias |
|
23 |
+ * @return void |
|
24 |
+ * |
|
25 |
+ * @throws \LogicException |
|
26 |
+ */ |
|
27 |
+ public function alias($abstract, $alias); |
|
28 |
+ |
|
29 |
+ /** |
|
30 |
+ * Assign a set of tags to a given binding. |
|
31 |
+ * |
|
32 |
+ * @param array|string $abstracts |
|
33 |
+ * @param array|mixed ...$tags |
|
34 |
+ * @return void |
|
35 |
+ */ |
|
36 |
+ public function tag($abstracts, $tags); |
|
37 |
+ |
|
38 |
+ /** |
|
39 |
+ * Resolve all of the bindings for a given tag. |
|
40 |
+ * |
|
41 |
+ * @param string $tag |
|
42 |
+ * @return iterable |
|
43 |
+ */ |
|
44 |
+ public function tagged($tag); |
|
45 |
+ |
|
46 |
+ /** |
|
47 |
+ * Register a binding with the container. |
|
48 |
+ * |
|
49 |
+ * @param string $abstract |
|
50 |
+ * @param \Closure|string|null $concrete |
|
51 |
+ * @param bool $shared |
|
52 |
+ * @return void |
|
53 |
+ */ |
|
54 |
+ public function bind($abstract, $concrete = null, $shared = false); |
|
55 |
+ |
|
56 |
+ /** |
|
57 |
+ * Register a binding if it hasn't already been registered. |
|
58 |
+ * |
|
59 |
+ * @param string $abstract |
|
60 |
+ * @param \Closure|string|null $concrete |
|
61 |
+ * @param bool $shared |
|
62 |
+ * @return void |
|
63 |
+ */ |
|
64 |
+ public function bindIf($abstract, $concrete = null, $shared = false); |
|
65 |
+ |
|
66 |
+ /** |
|
67 |
+ * Register a shared binding in the container. |
|
68 |
+ * |
|
69 |
+ * @param string $abstract |
|
70 |
+ * @param \Closure|string|null $concrete |
|
71 |
+ * @return void |
|
72 |
+ */ |
|
73 |
+ public function singleton($abstract, $concrete = null); |
|
74 |
+ |
|
75 |
+ /** |
|
76 |
+ * "Extend" an abstract type in the container. |
|
77 |
+ * |
|
78 |
+ * @param string $abstract |
|
79 |
+ * @param \Closure $closure |
|
80 |
+ * @return void |
|
81 |
+ * |
|
82 |
+ * @throws \InvalidArgumentException |
|
83 |
+ */ |
|
84 |
+ public function extend($abstract, Closure $closure); |
|
85 |
+ |
|
86 |
+ /** |
|
87 |
+ * Register an existing instance as shared in the container. |
|
88 |
+ * |
|
89 |
+ * @param string $abstract |
|
90 |
+ * @param mixed $instance |
|
91 |
+ * @return mixed |
|
92 |
+ */ |
|
93 |
+ public function instance($abstract, $instance); |
|
94 |
+ |
|
95 |
+ /** |
|
96 |
+ * Add a contextual binding to the container. |
|
97 |
+ * |
|
98 |
+ * @param string $concrete |
|
99 |
+ * @param string $abstract |
|
100 |
+ * @param \Closure|string $implementation |
|
101 |
+ * @return void |
|
102 |
+ */ |
|
103 |
+ public function addContextualBinding($concrete, $abstract, $implementation); |
|
104 |
+ |
|
105 |
+ /** |
|
106 |
+ * Define a contextual binding. |
|
107 |
+ * |
|
108 |
+ * @param string|array $concrete |
|
109 |
+ * @return \Illuminate\Contracts\Container\ContextualBindingBuilder |
|
110 |
+ */ |
|
111 |
+ public function when($concrete); |
|
112 |
+ |
|
113 |
+ /** |
|
114 |
+ * Get a closure to resolve the given type from the container. |
|
115 |
+ * |
|
116 |
+ * @param string $abstract |
|
117 |
+ * @return \Closure |
|
118 |
+ */ |
|
119 |
+ public function factory($abstract); |
|
120 |
+ |
|
121 |
+ /** |
|
122 |
+ * Flush the container of all bindings and resolved instances. |
|
123 |
+ * |
|
124 |
+ * @return void |
|
125 |
+ */ |
|
126 |
+ public function flush(); |
|
127 |
+ |
|
128 |
+ /** |
|
129 |
+ * Resolve the given type from the container. |
|
130 |
+ * |
|
131 |
+ * @param string $abstract |
|
132 |
+ * @param array $parameters |
|
133 |
+ * @return mixed |
|
134 |
+ * |
|
135 |
+ * @throws \Illuminate\Contracts\Container\BindingResolutionException |
|
136 |
+ */ |
|
137 |
+ public function make($abstract, array $parameters = []); |
|
138 |
+ |
|
139 |
+ /** |
|
140 |
+ * Call the given Closure / class@method and inject its dependencies. |
|
141 |
+ * |
|
142 |
+ * @param callable|string $callback |
|
143 |
+ * @param array $parameters |
|
144 |
+ * @param string|null $defaultMethod |
|
145 |
+ * @return mixed |
|
146 |
+ */ |
|
147 |
+ public function call($callback, array $parameters = [], $defaultMethod = null); |
|
148 |
+ |
|
149 |
+ /** |
|
150 |
+ * Determine if the given abstract type has been resolved. |
|
151 |
+ * |
|
152 |
+ * @param string $abstract |
|
153 |
+ * @return bool |
|
154 |
+ */ |
|
155 |
+ public function resolved($abstract); |
|
156 |
+ |
|
157 |
+ /** |
|
158 |
+ * Register a new resolving callback. |
|
159 |
+ * |
|
160 |
+ * @param \Closure|string $abstract |
|
161 |
+ * @param \Closure|null $callback |
|
162 |
+ * @return void |
|
163 |
+ */ |
|
164 |
+ public function resolving($abstract, Closure $callback = null); |
|
165 |
+ |
|
166 |
+ /** |
|
167 |
+ * Register a new after resolving callback. |
|
168 |
+ * |
|
169 |
+ * @param \Closure|string $abstract |
|
170 |
+ * @param \Closure|null $callback |
|
171 |
+ * @return void |
|
172 |
+ */ |
|
173 |
+ public function afterResolving($abstract, Closure $callback = null); |
|
174 |
+} |