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