1: <?php
2: namespace Opencart\Admin\Controller\Event;
3: /**
4: * Class Debug
5: *
6: * @package Opencart\Admin\Controller\Event
7: */
8: class Debug extends \Opencart\System\Engine\Controller {
9: /**
10: * Before
11: *
12: * @param string $route
13: * @param array<int, mixed> $args
14: *
15: * @return void
16: */
17: public function before(string &$route, array &$args): void {
18: if ($route == 'common/home') { // add the route you want to test
19: //$this->session->data['debug'][$route] = microtime();
20: }
21: }
22:
23: /**
24: * After
25: *
26: * @param string $route
27: * @param array<int, mixed> $args
28: * @param mixed $output
29: *
30: * @return void
31: */
32: public function after(string $route, array &$args, &$output): void {
33: if ($route == 'common/home') {
34: // add the route you want to test
35: if (isset($this->session->data['debug'][$route])) {
36: $log_data = [
37: 'route' => $route,
38: 'time' => microtime() - $this->session->data['debug'][$route]
39: ];
40:
41: $this->log->write($route);
42: }
43: }
44: }
45: }
46: