@@ -134,6 +134,8 @@ public function display(): array
134
134
$ data ['queries ' ] = array_map (static function (array $ query ) {
135
135
$ isDuplicate = $ query ['duplicate ' ] === true ;
136
136
137
+ $ firstNonSystemLine = '' ;
138
+
137
139
foreach ($ query ['trace ' ] as $ index => &$ line ) {
138
140
// simplify file and line
139
141
if (isset ($ line ['file ' ])) {
@@ -143,6 +145,11 @@ public function display(): array
143
145
$ line ['file ' ] = '[internal function] ' ;
144
146
}
145
147
148
+ // find the first trace line that does not originate from `system/`
149
+ if ($ firstNonSystemLine === '' && strpos ($ line ['file ' ], 'SYSTEMPATH ' ) === false ) {
150
+ $ firstNonSystemLine = $ line ['file ' ];
151
+ }
152
+
146
153
// simplify function call
147
154
if (isset ($ line ['class ' ])) {
148
155
$ line ['function ' ] = $ line ['class ' ] . $ line ['type ' ] . $ line ['function ' ];
@@ -162,20 +169,6 @@ public function display(): array
162
169
$ line ['index ' ] = $ indexPadded . str_repeat (chr (0xC2 ) . chr (0xA0 ), 4 );
163
170
}
164
171
165
- // remove the caller trace which is duplicated as the last item
166
- array_pop ($ query ['trace ' ]);
167
-
168
- // Find the first line that doesn't include `system` in the backtrace
169
- $ firstNonSystemLine = '' ;
170
-
171
- foreach ($ query ['trace ' ] as $ line ) {
172
- if (strpos ($ line ['file ' ], 'SYSTEMPATH ' ) === false ) {
173
- $ firstNonSystemLine = $ line ['file ' ];
174
-
175
- break ;
176
- }
177
- }
178
-
179
172
return [
180
173
'hover ' => $ isDuplicate ? 'This query was called more than once. ' : '' ,
181
174
'class ' => $ isDuplicate ? 'duplicate ' : '' ,
0 commit comments