1 | <?php |
||
10 | class Command extends \yii\db\Command |
||
11 | { |
||
12 | /** |
||
13 | * Trace tag. |
||
14 | */ |
||
15 | const TAG_TYPE_TRACE = 'TraceTag'; |
||
16 | /** |
||
17 | * Custom tag. |
||
18 | */ |
||
19 | const TAG_TYPE_CUSTOM = 'CustomTag'; |
||
20 | /** |
||
21 | * Script entry point tag. |
||
22 | */ |
||
23 | const TAG_TYPE_ENTRY_POINT = 'EnryPointTag'; |
||
24 | /** |
||
25 | * Enabled tags. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | public $enabledTags = [ |
||
30 | self::TAG_TYPE_TRACE, |
||
31 | ]; |
||
32 | /** |
||
33 | * Custom tag value. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | public $customTag = ''; |
||
38 | /** |
||
39 | * Maximum trace entries in query. |
||
40 | * |
||
41 | * @var int |
||
42 | */ |
||
43 | public $traceLevel = 4; |
||
44 | /** |
||
45 | * Maximum debug_backtrace() level param. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | public $backTraceLevel = 12; |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public function setSql($sql) |
||
62 | |||
63 | /** |
||
64 | * Generates custom tag. |
||
65 | */ |
||
66 | protected function getCustomTag() |
||
70 | |||
71 | /** |
||
72 | * Generates trace tag. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | protected function getTraceTag(): string |
||
94 | |||
95 | /** |
||
96 | * Inserts tags into query string. |
||
97 | * |
||
98 | * @param string $sql Query. |
||
99 | * @return string |
||
100 | */ |
||
101 | protected function insertTags(string $sql): string |
||
121 | |||
122 | /** |
||
123 | * Trace entry. |
||
124 | * |
||
125 | * @param array $trace Trace properties array. |
||
126 | * @return string |
||
127 | */ |
||
128 | protected function getTraceLine(array $trace): string |
||
134 | } |
||
135 |