1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,69 +0,0 @@ |
1 |
-<?php |
|
2 |
- |
|
3 |
-namespace Illuminate\Support\Traits; |
|
4 |
- |
|
5 |
-use Illuminate\Support\Fluent; |
|
6 |
-use Illuminate\Contracts\Container\Container; |
|
7 |
- |
|
8 |
-trait CapsuleManagerTrait |
|
9 |
-{ |
|
10 |
- /** |
|
11 |
- * The current globally used instance. |
|
12 |
- * |
|
13 |
- * @var object |
|
14 |
- */ |
|
15 |
- protected static $instance; |
|
16 |
- |
|
17 |
- /** |
|
18 |
- * The container instance. |
|
19 |
- * |
|
20 |
- * @var \Illuminate\Contracts\Container\Container |
|
21 |
- */ |
|
22 |
- protected $container; |
|
23 |
- |
|
24 |
- /** |
|
25 |
- * Setup the IoC container instance. |
|
26 |
- * |
|
27 |
- * @param \Illuminate\Contracts\Container\Container $container |
|
28 |
- * @return void |
|
29 |
- */ |
|
30 |
- protected function setupContainer(Container $container) |
|
31 |
- { |
|
32 |
- $this->container = $container; |
|
33 |
- |
|
34 |
- if (! $this->container->bound('config')) { |
|
35 |
- $this->container->instance('config', new Fluent); |
|
36 |
- } |
|
37 |
- } |
|
38 |
- |
|
39 |
- /** |
|
40 |
- * Make this capsule instance available globally. |
|
41 |
- * |
|
42 |
- * @return void |
|
43 |
- */ |
|
44 |
- public function setAsGlobal() |
|
45 |
- { |
|
46 |
- static::$instance = $this; |
|
47 |
- } |
|
48 |
- |
|
49 |
- /** |
|
50 |
- * Get the IoC container instance. |
|
51 |
- * |
|
52 |
- * @return \Illuminate\Contracts\Container\Container |
|
53 |
- */ |
|
54 |
- public function getContainer() |
|
55 |
- { |
|
56 |
- return $this->container; |
|
57 |
- } |
|
58 |
- |
|
59 |
- /** |
|
60 |
- * Set the IoC container instance. |
|
61 |
- * |
|
62 |
- * @param \Illuminate\Contracts\Container\Container $container |
|
63 |
- * @return void |
|
64 |
- */ |
|
65 |
- public function setContainer(Container $container) |
|
66 |
- { |
|
67 |
- $this->container = $container; |
|
68 |
- } |
|
69 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,69 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace Illuminate\Support\Traits; |
|
4 |
+ |
|
5 |
+use Illuminate\Support\Fluent; |
|
6 |
+use Illuminate\Contracts\Container\Container; |
|
7 |
+ |
|
8 |
+trait CapsuleManagerTrait |
|
9 |
+{ |
|
10 |
+ /** |
|
11 |
+ * The current globally used instance. |
|
12 |
+ * |
|
13 |
+ * @var object |
|
14 |
+ */ |
|
15 |
+ protected static $instance; |
|
16 |
+ |
|
17 |
+ /** |
|
18 |
+ * The container instance. |
|
19 |
+ * |
|
20 |
+ * @var \Illuminate\Contracts\Container\Container |
|
21 |
+ */ |
|
22 |
+ protected $container; |
|
23 |
+ |
|
24 |
+ /** |
|
25 |
+ * Setup the IoC container instance. |
|
26 |
+ * |
|
27 |
+ * @param \Illuminate\Contracts\Container\Container $container |
|
28 |
+ * @return void |
|
29 |
+ */ |
|
30 |
+ protected function setupContainer(Container $container) |
|
31 |
+ { |
|
32 |
+ $this->container = $container; |
|
33 |
+ |
|
34 |
+ if (! $this->container->bound('config')) { |
|
35 |
+ $this->container->instance('config', new Fluent); |
|
36 |
+ } |
|
37 |
+ } |
|
38 |
+ |
|
39 |
+ /** |
|
40 |
+ * Make this capsule instance available globally. |
|
41 |
+ * |
|
42 |
+ * @return void |
|
43 |
+ */ |
|
44 |
+ public function setAsGlobal() |
|
45 |
+ { |
|
46 |
+ static::$instance = $this; |
|
47 |
+ } |
|
48 |
+ |
|
49 |
+ /** |
|
50 |
+ * Get the IoC container instance. |
|
51 |
+ * |
|
52 |
+ * @return \Illuminate\Contracts\Container\Container |
|
53 |
+ */ |
|
54 |
+ public function getContainer() |
|
55 |
+ { |
|
56 |
+ return $this->container; |
|
57 |
+ } |
|
58 |
+ |
|
59 |
+ /** |
|
60 |
+ * Set the IoC container instance. |
|
61 |
+ * |
|
62 |
+ * @param \Illuminate\Contracts\Container\Container $container |
|
63 |
+ * @return void |
|
64 |
+ */ |
|
65 |
+ public function setContainer(Container $container) |
|
66 |
+ { |
|
67 |
+ $this->container = $container; |
|
68 |
+ } |
|
69 |
+} |