1 | <?php |
||
21 | class Carbon_Fields { |
||
22 | |||
23 | /** |
||
24 | * Flag if Carbon Fields has been booted |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | public $booted = false; |
||
29 | |||
30 | /** |
||
31 | * Array of callables to call on boot |
||
32 | * |
||
33 | * @var array<callable> |
||
34 | */ |
||
35 | public $boot_actions = array(); |
||
36 | |||
37 | /** |
||
38 | * Inversion of Control container instance |
||
39 | * |
||
40 | * @var PimpleContainer |
||
41 | */ |
||
42 | protected $ioc = null; |
||
43 | |||
44 | /** |
||
45 | * Singleton implementation |
||
46 | * |
||
47 | * @return Carbon_Fields\Carbon_Fields |
||
48 | */ |
||
49 | public static function instance() { |
||
56 | |||
57 | /** |
||
58 | * Get default IoC container dependencies |
||
59 | * |
||
60 | * @return PimpleContainer |
||
61 | */ |
||
62 | protected static function get_default_ioc() { |
||
110 | |||
111 | /** |
||
112 | * Resolve a dependency through IoC |
||
113 | * |
||
114 | * @param string $key |
||
115 | * @return mixed |
||
116 | */ |
||
117 | public static function resolve( $key ) { |
||
120 | |||
121 | /** |
||
122 | * Resolve a service through IoC |
||
123 | * |
||
124 | * @param string $service_name |
||
125 | * @return mixed |
||
126 | */ |
||
127 | public static function service( $service_name ) { |
||
130 | |||
131 | /** |
||
132 | * Check if a dependency is registered |
||
133 | * |
||
134 | * @param string $key |
||
135 | * @return bool |
||
136 | */ |
||
137 | public static function has( $key ) { |
||
140 | |||
141 | /** |
||
142 | * Replace the ioc container for Carbon_Fields\Carbon_Fields |
||
143 | * |
||
144 | * @param PimpleContainer $ioc |
||
145 | */ |
||
146 | public function install( PimpleContainer $ioc ) { |
||
149 | |||
150 | /** |
||
151 | * Boot Carbon Fields with default IoC dependencies |
||
152 | */ |
||
153 | public static function boot() { |
||
171 | |||
172 | /** |
||
173 | * Check if Carbon Fields has booted |
||
174 | */ |
||
175 | public static function is_booted() { |
||
178 | |||
179 | /** |
||
180 | * Throw exception if Carbon Fields has not been booted |
||
181 | */ |
||
182 | public static function verify_boot() { |
||
187 | |||
188 | /** |
||
189 | * Add a callable to execute on boot |
||
190 | * |
||
191 | * @param callable $callable |
||
192 | */ |
||
193 | public static function on_boot( $callable ) { |
||
199 | } |