PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / trunk
Pods – Custom Content Types and Fields vtrunk
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Integrations / Query_Monitor / Collectors / Debug.php
pods / src / Pods / Integrations / Query_Monitor / Collectors Last commit date
Constants.php 4 months ago Debug.php 4 months ago
Debug.php
78 lines
1 <?php
2
3 namespace Pods\Integrations\Query_Monitor\Collectors;
4
5 // Don't load directly.
6 if ( ! defined( 'ABSPATH' ) ) {
7 die( '-1' );
8 }
9
10 use QM_Backtrace;
11 use QM_DataCollector;
12
13 /**
14 * Class Debug
15 *
16 * @since 3.2.7
17 */
18 class Debug extends QM_DataCollector {
19
20 public $id = 'pods-debug';
21
22 /**
23 * The data to be tracked.
24 *
25 * @since 3.2.7
26 *
27 * @var array
28 */
29 protected static $custom_data = [];
30
31 public function process() {
32 $this->data['debug_data'] = self::get_debug_data();
33 }
34
35 /**
36 * Track debug data.
37 *
38 * @since 3.2.7
39 *
40 * @param mixed $debug The debug data to track.
41 * @param string $context The context where the debug came from.
42 * @param string $function The function/method name where the debug was called.
43 * @param int $line The line number where the debug was called.
44 */
45 public static function track_debug_data( $debug, string $context, string $function, int $line ): void {
46 $trace = new QM_Backtrace( [
47 'ignore_hook' => [
48 current_filter() => true,
49 ],
50 'ignore_func' => [
51 'pods_debug_log_data' => true,
52 ],
53 ] );
54
55 self::$custom_data[] = compact( 'debug', 'context', 'function', 'line', 'trace' );
56 }
57
58 /**
59 * Get all of the debug data tracked.
60 *
61 * @since 3.2.7
62 *
63 * @return array All of the debug data tracked.
64 */
65 public static function get_debug_data(): array {
66 return self::$custom_data;
67 }
68
69 /**
70 * Reset all of the debug data tracked.
71 *
72 * @since 3.2.7
73 */
74 public static function reset_debug_data(): void {
75 self::$custom_data = [];
76 }
77 }
78