1 | <?php |
||
50 | class Kernel |
||
51 | { |
||
52 | /** |
||
53 | * Kernel instance |
||
54 | * |
||
55 | * @var \Apparat\Kernel\Domain\Model\Kernel |
||
56 | */ |
||
57 | protected static $kernel = null; |
||
58 | |||
59 | /******************************************************************************* |
||
60 | * PUBLIC METHODS |
||
61 | *******************************************************************************/ |
||
62 | |||
63 | /** |
||
64 | * Register an apparat module |
||
65 | * |
||
66 | * @param ModuleInterface $module Apparat module |
||
67 | */ |
||
68 | public static function register(ModuleInterface $module) |
||
72 | |||
73 | /** |
||
74 | * Create an object instance |
||
75 | * |
||
76 | * @param string $name Object class name |
||
77 | * @param array $args Object constructor arguments |
||
78 | * @return object Object instance |
||
79 | */ |
||
80 | public static function create($name, array $args = []) |
||
84 | |||
85 | /** |
||
86 | * System is unusable |
||
87 | * |
||
88 | * @param string $message |
||
89 | * @param array $context |
||
90 | * @return null |
||
91 | */ |
||
92 | public static function emergency($message, array $context = array()) |
||
96 | |||
97 | /** |
||
98 | * Action must be taken immediately |
||
99 | * |
||
100 | * Example: Entire website down, database unavailable, etc. This should |
||
101 | * trigger the SMS alerts and wake you up. |
||
102 | * |
||
103 | * @param string $message |
||
104 | * @param array $context |
||
105 | * @return null |
||
106 | */ |
||
107 | public static function alert($message, array $context = array()) |
||
111 | |||
112 | /** |
||
113 | * Critical conditions |
||
114 | * |
||
115 | * Example: Application component unavailable, unexpected exception. |
||
116 | * |
||
117 | * @param string $message |
||
118 | * @param array $context |
||
119 | * @return null |
||
120 | */ |
||
121 | public static function critical($message, array $context = array()) |
||
125 | |||
126 | /** |
||
127 | * Runtime errors that do not require immediate action but should typically |
||
128 | * be logged and monitored |
||
129 | * |
||
130 | * @param string $message |
||
131 | * @param array $context |
||
132 | * @return null |
||
133 | */ |
||
134 | public static function error($message, array $context = array()) |
||
138 | |||
139 | /** |
||
140 | * Exceptional occurrences that are not errors |
||
141 | * |
||
142 | * Example: Use of deprecated APIs, poor use of an API, undesirable things |
||
143 | * that are not necessarily wrong. |
||
144 | * |
||
145 | * @param string $message |
||
146 | * @param array $context |
||
147 | * @return null |
||
148 | */ |
||
149 | public static function warning($message, array $context = array()) |
||
153 | |||
154 | /** |
||
155 | * Normal but significant events |
||
156 | * |
||
157 | * @param string $message |
||
158 | * @param array $context |
||
159 | * @return null |
||
160 | */ |
||
161 | public static function notice($message, array $context = array()) |
||
165 | |||
166 | /** |
||
167 | * Interesting events |
||
168 | * |
||
169 | * Example: User logs in, SQL logs. |
||
170 | * |
||
171 | * @param string $message |
||
172 | * @param array $context |
||
173 | * @return null |
||
174 | */ |
||
175 | public static function info($message, array $context = array()) |
||
179 | |||
180 | /** |
||
181 | * Detailed debug information |
||
182 | * |
||
183 | * @param string $message |
||
184 | * @param array $context |
||
185 | * @return null |
||
186 | */ |
||
187 | public static function debug($message, array $context = array()) |
||
191 | |||
192 | /** |
||
193 | * Logs with an arbitrary level |
||
194 | * |
||
195 | * @param mixed $level |
||
196 | * @param string $message |
||
197 | * @param array $context |
||
198 | * @return null |
||
199 | */ |
||
200 | public static function log($level, $message, array $context = array()) |
||
204 | |||
205 | /******************************************************************************* |
||
206 | * PRIVATE METHODS |
||
207 | *******************************************************************************/ |
||
208 | |||
209 | /** |
||
210 | * Return the kernel instance |
||
211 | * |
||
212 | * @return \Apparat\Kernel\Domain\Model\Kernel Kernel instance |
||
213 | */ |
||
214 | protected static function getKernel() |
||
222 | } |
||
223 |