6
6
* of the migration resolver and database classes, which are used
7
7
* to perform various support functions for the migrator.
8
8
*/
9
- IoC::register ('task: migrate ' , function ( )
9
+ if (! IoC::registered ('task: migrate ' ) )
10
10
{
11
- $ database = new Tasks \Migrate \Database ;
11
+ IoC::register ('task: migrate ' , function ()
12
+ {
13
+ $ database = new Tasks \Migrate \Database ;
12
14
13
- $ resolver = new Tasks \Migrate \Resolver ($ database );
15
+ $ resolver = new Tasks \Migrate \Resolver ($ database );
16
+
17
+ return new Tasks \Migrate \Migrator ($ resolver , $ database );
18
+ });
19
+ }
14
20
15
- return new Tasks \Migrate \Migrator ($ resolver , $ database );
16
- });
17
21
18
22
/**
19
23
* The bundle task is responsible for the installation of bundles
20
24
* and their dependencies. It utilizes the bundles API to get the
21
25
* meta-data for the available bundles.
22
26
*/
23
- IoC::register ('task: bundle ' , function ( )
27
+ if (! IoC::registered ('task: bundle ' ) )
24
28
{
25
- $ repository = IoC::resolve ('bundle.repository ' );
29
+ IoC::register ('task: bundle ' , function ()
30
+ {
31
+ $ repository = IoC::resolve ('bundle.repository ' );
26
32
27
- return new Tasks \Bundle \Bundler ($ repository );
28
- });
33
+ return new Tasks \Bundle \Bundler ($ repository );
34
+ });
35
+ }
29
36
30
37
/**
31
38
* The key task is responsible for generating a secure, random
32
39
* key for use by the application when encrypting strings or
33
40
* setting the hash values on cookie signatures.
34
41
*/
35
- IoC::singleton ('task: key ' , function ( )
42
+ if (! IoC::registered ('task: key ' ) )
36
43
{
37
- return new Tasks \Key ;
38
- });
44
+ IoC::singleton ('task: key ' , function ()
45
+ {
46
+ return new Tasks \Key ;
47
+ });
48
+ }
39
49
40
50
/**
41
51
* The session task is responsible for performing tasks related
42
52
* to the session store of the application. It can do things
43
53
* such as generating the session table or clearing expired
44
54
* sessions from storage.
45
55
*/
46
- IoC::singleton ('task: session ' , function ( )
56
+ if (! IoC::registered ('task: session ' ) )
47
57
{
48
- return new Tasks \Session \Manager ;
49
- });
58
+ IoC::singleton ('task: session ' , function ()
59
+ {
60
+ return new Tasks \Session \Manager ;
61
+ });
62
+ }
50
63
51
64
/**
52
65
* The route task is responsible for calling routes within the
53
66
* application and dumping the result. This allows for simple
54
67
* testing of APIs and JSON based applications.
55
68
*/
56
- IoC::singleton ('task: route ' , function ( )
69
+ if (! IoC::registered ('task: route ' ) )
57
70
{
58
- return new Tasks \Route ;
59
- });
71
+ IoC::singleton ('task: route ' , function ()
72
+ {
73
+ return new Tasks \Route ;
74
+ });
75
+ }
60
76
61
77
/**
62
78
* The "test" task is responsible for running the unit tests for
63
79
* the application, bundles, and the core framework itself.
64
80
* It provides a nice wrapper around PHPUnit.
65
81
*/
66
- IoC::singleton ('task: test ' , function ( )
82
+ if (! IoC::registered ('task: test ' ) )
67
83
{
68
- return new Tasks \Test \Runner ;
69
- });
84
+ IoC::singleton ('task: test ' , function ()
85
+ {
86
+ return new Tasks \Test \Runner ;
87
+ });
88
+ }
70
89
71
90
/**
72
91
* The bundle repository is responsible for communicating with
73
92
* the Laravel bundle sources to get information regarding any
74
93
* bundles that are requested for installation.
75
94
*/
76
- IoC::singleton ('bundle.repository ' , function ( )
95
+ if (! IoC::registered ('bundle.repository ' ) )
77
96
{
78
- return new Tasks \Bundle \Repository ;
79
- });
97
+ IoC::singleton ('bundle.repository ' , function ()
98
+ {
99
+ return new Tasks \Bundle \Repository ;
100
+ });
101
+ }
80
102
81
103
/**
82
104
* The bundle publisher is responsible for publishing bundle
83
105
* assets to their correct directories within the install,
84
106
* such as the web accessible directory.
85
107
*/
86
- IoC::singleton ('bundle.publisher ' , function ( )
108
+ if (! IoC::registered ('bundle.publisher ' ) )
87
109
{
88
- return new Tasks \Bundle \Publisher ;
89
- });
110
+ IoC::singleton ('bundle.publisher ' , function ()
111
+ {
112
+ return new Tasks \Bundle \Publisher ;
113
+ });
114
+ }
90
115
91
116
/**
92
117
* The Github bundle provider installs bundles that live on
93
118
* Github. This provider will add the bundle as a submodule
94
119
* and will update the submodule so that the bundle is
95
120
* installed into the bundle directory.
96
121
*/
97
- IoC::singleton ('bundle.provider: github ' , function ( )
122
+ if (! IoC::registered ('bundle.provider: github ' ) )
98
123
{
99
- return new Tasks \Bundle \Providers \Github ;
100
- });
124
+ IoC::singleton ('bundle.provider: github ' , function ()
125
+ {
126
+ return new Tasks \Bundle \Providers \Github ;
127
+ });
128
+ }
0 commit comments