@@ -20,7 +20,7 @@ Use internal container in controller and Application:
20
20
$session = $this->container->get('system.session');
21
21
```
22
22
23
- Or use ` Ioc ` static class to get it:
23
+ Or use static method in ` Ioc ` class to get it:
24
24
25
25
``` php
26
26
$container = \Windwalker\Ioc::factory(); // This container is singleton
@@ -36,7 +36,7 @@ $container->set('my.input', $input);
36
36
$input = $container->get('my.input');
37
37
```
38
38
39
- Or directly get it by ` Ioc ` :
39
+ Or get it by ` Ioc:get() ` statically :
40
40
41
41
``` php
42
42
\Windwalker\Ioc::get('my.input');
@@ -68,7 +68,7 @@ Directly get object from sub container by `Ioc`:
68
68
69
69
# Lazy Loading
70
70
71
- Sometimes we will hope not create object instantly, we can use callback to create object.
71
+ Use callback function as input value if we do not want to create object instantly .
72
72
73
73
``` php
74
74
// Set a closure into it
@@ -81,7 +81,7 @@ $container->set('input', function(Container $container)
81
81
$input = $container->get('input');
82
82
```
83
83
84
- But if we use ` set() ` method to set callback, this object will be recreated when every time we try to get it .
84
+ But if we use ` set() ` method to set callback, this object will be re-created everytime .
85
85
86
86
# Shared Object (Singleton)
87
87
@@ -97,7 +97,7 @@ $container->share('input', function(Container $container)
97
97
// Will will always get same instance
98
98
$input = $container->get('input');
99
99
100
- // The second argument of get() can force create new instance
100
+ // The second argument of get() is whether forced to create new instance or not
101
101
$newInput = $container->get('input', true);
102
102
103
103
// Use readable constant
@@ -106,7 +106,7 @@ $newInput = $container->get('input', Container::FORCE_NEW);
106
106
107
107
# Protect Object
108
108
109
- Use ` protect() ` to prevent others override your important object.
109
+ Use ` protect() ` to prevent others from overriding your important object.
110
110
111
111
``` php
112
112
$container->protect(
@@ -195,7 +195,7 @@ abstract class Ioc extends \Windwalker\Core\Ioc
195
195
196
196
# Build Object
197
197
198
- Container can build an object and auto inject the needed dependency objects .
198
+ Container can build an object and automatically inject all the necessary dependencies .
199
199
200
200
``` php
201
201
use Windwalker\IO\Input;
@@ -282,7 +282,7 @@ $flower->name; // sakura
282
282
283
283
# Container Aware
284
284
285
- The ` ContainerAwareInterface ` help us get and set Container as a system, constructor, we often use it on application or controller classes.
285
+ The ` ContainerAwareInterface ` defines getter & setter of Container as a system, constructor, we often use it on application or controller classes.
286
286
287
287
``` php
288
288
use Windwalker\DI\ContainerAwareInterface;
0 commit comments