1 | <?php |
||
17 | class App { |
||
18 | |||
19 | /** |
||
20 | * Flag if Carbon Fields has been booted |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | public $booted = false; |
||
25 | |||
26 | /** |
||
27 | * Inversion of Control container instance |
||
28 | * |
||
29 | * @var PimpleContainer |
||
30 | */ |
||
31 | protected $ioc = null; |
||
32 | |||
33 | /** |
||
34 | * Singleton implementation |
||
35 | * |
||
36 | * @return App |
||
37 | */ |
||
38 | public static function instance() { |
||
45 | |||
46 | /** |
||
47 | * Get default IoC container dependencies |
||
48 | * |
||
49 | * @return PimpleContainer |
||
50 | */ |
||
51 | protected static function get_default_ioc() { |
||
86 | |||
87 | /** |
||
88 | * Resolve a dependency through IoC |
||
89 | * |
||
90 | * @param string $key |
||
91 | * @return mixed |
||
92 | */ |
||
93 | public static function resolve( $key ) { |
||
96 | |||
97 | /** |
||
98 | * Resolve a service through IoC |
||
99 | * |
||
100 | * @param string $service_name |
||
101 | * @return mixed |
||
102 | */ |
||
103 | public static function service( $service_name ) { |
||
106 | |||
107 | /** |
||
108 | * Replace the ioc container for the App |
||
109 | * |
||
110 | * @param PimpleContainer $ioc |
||
111 | */ |
||
112 | public function install( PimpleContainer $ioc ) { |
||
115 | |||
116 | /** |
||
117 | * Boot Carbon Fields with default IoC dependencies |
||
118 | */ |
||
119 | public static function boot() { |
||
132 | |||
133 | /** |
||
134 | * Check if Carbon Fields has booted |
||
135 | */ |
||
136 | public static function is_booted() { |
||
139 | |||
140 | /** |
||
141 | * Throw exception if Carbon Fields has not been booted |
||
142 | */ |
||
143 | public static function verify_boot() { |
||
148 | } |