1 | <?php |
||
43 | class Profiler implements ProfilerInterface |
||
44 | { |
||
45 | use LoggerAwareTrait; |
||
46 | |||
47 | /** |
||
48 | * @var ContextInterface |
||
49 | */ |
||
50 | protected $context; |
||
51 | |||
52 | /** |
||
53 | * @var DataSourceInterface |
||
54 | */ |
||
55 | protected $datasource; |
||
56 | |||
57 | /** |
||
58 | * @var Timeline |
||
59 | */ |
||
60 | protected $timeline; |
||
61 | |||
62 | /** |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $collectors; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | */ |
||
70 | public static $environment; |
||
71 | |||
72 | /** |
||
73 | * @var bool |
||
74 | */ |
||
75 | protected $terminated = false; |
||
76 | |||
77 | /** |
||
78 | * |
||
79 | */ |
||
80 | 126 | public function __construct() |
|
98 | |||
99 | /** |
||
100 | * Try to terminate the profiler at the destruction if it was not done manually |
||
101 | */ |
||
102 | 98 | public function __destruct() |
|
106 | |||
107 | /** |
||
108 | * @return string |
||
109 | */ |
||
110 | 126 | public static function detectEnv() |
|
118 | |||
119 | /** |
||
120 | * Add a data collector to the profiler |
||
121 | * @param CollectorInterface $collector |
||
122 | * @throws \RuntimeException |
||
123 | */ |
||
124 | 124 | public function registerCollector(CollectorInterface $collector) |
|
137 | |||
138 | /** |
||
139 | * Register multiple collector to the profiler |
||
140 | * @param array $collectors |
||
141 | * @throws \RuntimeException |
||
142 | */ |
||
143 | 2 | public function registerCollectors(array $collectors) |
|
149 | |||
150 | /** |
||
151 | * Build and register collector class |
||
152 | * @param $className |
||
153 | * @throws \RuntimeException |
||
154 | */ |
||
155 | 110 | public function registerCollectorClass($className) |
|
161 | |||
162 | /** |
||
163 | * Build and register collector classes |
||
164 | * @param array $collectors |
||
165 | * @throws \RuntimeException |
||
166 | */ |
||
167 | 106 | public function registerCollectorClasses(array $collectors) |
|
173 | |||
174 | /** |
||
175 | * Run start collector at the profiler creation |
||
176 | */ |
||
177 | 12 | public function initiate() |
|
181 | |||
182 | /** |
||
183 | * Run final collectors, just before the profiler was destroy |
||
184 | */ |
||
185 | 102 | public function terminate() |
|
192 | |||
193 | 104 | public function runGroup($name) |
|
224 | |||
225 | /** |
||
226 | * @param DataSourceInterface $datasource |
||
227 | */ |
||
228 | 126 | public function setDataSource($datasource) |
|
232 | |||
233 | /** |
||
234 | * @return DataSourceInterface |
||
235 | */ |
||
236 | 28 | public function getDatasource() |
|
240 | |||
241 | /** |
||
242 | * @param $id |
||
243 | * @return mixed |
||
244 | */ |
||
245 | 18 | public function getProfile($id) |
|
249 | |||
250 | /** |
||
251 | * @return ContextInterface |
||
252 | */ |
||
253 | 120 | public function getContext() |
|
257 | |||
258 | /** |
||
259 | * @return array |
||
260 | */ |
||
261 | 24 | public function getCollectors() |
|
265 | |||
266 | /** |
||
267 | * @param LoggerInterface $logger |
||
268 | * @return $this |
||
269 | */ |
||
270 | 102 | public function setLogger(LoggerInterface $logger) |
|
280 | |||
281 | /** |
||
282 | * @return LoggerInterface|AbstractProcessingHandler |
||
283 | */ |
||
284 | 4 | public function getLogger() |
|
288 | |||
289 | /** |
||
290 | * @param $name |
||
291 | * @param $arguments |
||
292 | * @return mixed |
||
293 | * @throws \BadMethodCallException |
||
294 | */ |
||
295 | 6 | public function __call($name, $arguments) |
|
307 | |||
308 | /** |
||
309 | * @param $object |
||
310 | * @param $methode |
||
311 | * @return bool |
||
312 | */ |
||
313 | 6 | protected function isMethodAvailable($object, $methode) |
|
317 | |||
318 | /** |
||
319 | * @param Timeline $timeline |
||
320 | */ |
||
321 | 100 | public function setTimeline($timeline) |
|
325 | |||
326 | /** |
||
327 | * @param Response $response |
||
328 | */ |
||
329 | public function setResponse(Response $response) |
||
333 | } |
||
334 |