@@ -144,14 +144,17 @@ public function boot()
144144 /** @var Application $app */
145145 $ app = $ this ->app ;
146146
147+ /** @var \Illuminate\Config\Repository $config */
148+ $ config = $ app ['config ' ];
149+
147150 /** @var \Illuminate\Events\Dispatcher|null $events */
148151 $ events = isset ($ app ['events ' ]) ? $ app ['events ' ] : null ;
149152
150- $ this ->editorTemplateLink = $ this -> app [ ' config ' ] ->get ('debugbar.editor ' ) ?: null ;
153+ $ this ->editorTemplateLink = $ config ->get ('debugbar.editor ' ) ?: null ;
151154 $ this ->remoteServerReplacements = $ this ->getRemoteServerReplacements ();
152155
153156 // Set custom error handler
154- if ($ app [ ' config ' ] ->get ('debugbar.error_handler ' , false )) {
157+ if ($ config ->get ('debugbar.error_handler ' , false )) {
155158 set_error_handler ([$ this , 'handleError ' ]);
156159 }
157160
@@ -162,25 +165,23 @@ public function boot()
162165 }
163166
164167 if ($ this ->shouldCollect ('messages ' , true )) {
165- $ trace = $ this ->app ['config ' ]->get ('debugbar.options.messages.trace ' , true );
166- $ messages = new MessagesCollector ();
167- if ($ trace ) {
168- $ messages ->collectFileTrace (true );
169- }
168+ $ this ->addCollector (new MessagesCollector ());
170169
171- $ this ->addCollector ($ messages );
170+ if ($ config ->get ('debugbar.options.messages.trace ' , true )) {
171+ $ this ['messages ' ]->collectFileTrace (true );
172+ }
172173 }
173174
174175 if ($ this ->shouldCollect ('time ' , true )) {
175176 $ startTime = $ app ['request ' ]->server ('REQUEST_TIME_FLOAT ' );
176177 $ this ->addCollector (new TimeDataCollector ($ startTime ));
177178
178- if ($ app [ ' config ' ] ->get ('debugbar.options.time.memory_usage ' )) {
179+ if ($ config ->get ('debugbar.options.time.memory_usage ' )) {
179180 $ debugbar ['time ' ]->showMemoryUsage ();
180181 }
181182
182183 if (! $ this ->isLumen () && $ startTime ) {
183- $ this -> app ->booted (
184+ $ app ->booted (
184185 function () use ($ debugbar , $ startTime ) {
185186 $ debugbar ->addMeasure ('Booting ' , $ startTime , microtime (true ), [], 'time ' );
186187 }
@@ -193,12 +194,12 @@ function () use ($debugbar, $startTime) {
193194 if ($ this ->shouldCollect ('memory ' , true )) {
194195 $ memoryCollector = new MemoryCollector ();
195196 if (method_exists ($ memoryCollector , 'setPrecision ' )) {
196- $ memoryCollector ->setPrecision ($ app [ ' config ' ] ->get ('debugbar.options.memory.precision ' , 0 ));
197+ $ memoryCollector ->setPrecision ($ config ->get ('debugbar.options.memory.precision ' , 0 ));
197198 }
198- if (function_exists ('memory_reset_peak_usage ' ) && $ app [ ' config ' ] ->get ('debugbar.options.memory.reset_peak ' )) {
199+ if (function_exists ('memory_reset_peak_usage ' ) && $ config ->get ('debugbar.options.memory.reset_peak ' )) {
199200 memory_reset_peak_usage ();
200201 }
201- if ($ app [ ' config ' ] ->get ('debugbar.options.memory.with_baseline ' )) {
202+ if ($ config ->get ('debugbar.options.memory.with_baseline ' )) {
202203 $ memoryCollector ->resetMemoryBaseline ();
203204 }
204205 $ this ->addCollector ($ memoryCollector );
@@ -208,15 +209,15 @@ function () use ($debugbar, $startTime) {
208209 try {
209210 $ exceptionCollector = new ExceptionsCollector ();
210211 $ exceptionCollector ->setChainExceptions (
211- $ this -> app [ ' config ' ] ->get ('debugbar.options.exceptions.chain ' , true )
212+ $ config ->get ('debugbar.options.exceptions.chain ' , true )
212213 );
213214 $ this ->addCollector ($ exceptionCollector );
214215 } catch (Exception $ e ) {
215216 }
216217 }
217218
218219 if ($ this ->shouldCollect ('laravel ' , false )) {
219- $ this ->addCollector (new LaravelCollector ($ this -> app ));
220+ $ this ->addCollector (new LaravelCollector ($ app ));
220221 }
221222
222223 if ($ this ->shouldCollect ('default_request ' , false )) {
@@ -226,7 +227,7 @@ function () use ($debugbar, $startTime) {
226227 if ($ this ->shouldCollect ('events ' , false ) && $ events ) {
227228 try {
228229 $ startTime = $ app ['request ' ]->server ('REQUEST_TIME_FLOAT ' );
229- $ collectData = $ app [ ' config ' ] ->get ('debugbar.options.events.data ' , false );
230+ $ collectData = $ config ->get ('debugbar.options.events.data ' , false );
230231 $ this ->addCollector (new EventCollector ($ startTime , $ collectData ));
231232 $ events ->subscribe ($ this ['event ' ]);
232233 } catch (Exception $ e ) {
@@ -236,9 +237,9 @@ function () use ($debugbar, $startTime) {
236237
237238 if ($ this ->shouldCollect ('views ' , true ) && $ events ) {
238239 try {
239- $ collectData = $ this -> app [ ' config ' ] ->get ('debugbar.options.views.data ' , true );
240- $ excludePaths = $ this -> app [ ' config ' ] ->get ('debugbar.options.views.exclude_paths ' , []);
241- $ group = $ this -> app [ ' config ' ] ->get ('debugbar.options.views.group ' , true );
240+ $ collectData = $ config ->get ('debugbar.options.views.data ' , true );
241+ $ excludePaths = $ config ->get ('debugbar.options.views.exclude_paths ' , []);
242+ $ group = $ config ->get ('debugbar.options.views.group ' , true );
242243 $ this ->addCollector (new ViewCollector ($ collectData , $ excludePaths , $ group ));
243244 $ events ->listen (
244245 'composing:* ' ,
@@ -264,7 +265,7 @@ function ($event, $params) {
264265 if ($ this ->hasCollector ('messages ' )) {
265266 $ logger = new MessagesCollector ('log ' );
266267 $ this ['messages ' ]->aggregate ($ logger );
267- $ this -> app ['log ' ]->listen (
268+ $ app ['log ' ]->listen (
268269 function (\Illuminate \Log \Events \MessageLogged $ log ) use ($ logger ) {
269270 try {
270271 $ logMessage = (string ) $ log ->message ;
@@ -292,47 +293,42 @@ function (\Illuminate\Log\Events\MessageLogged $log) use ($logger) {
292293 }
293294 }
294295
295- if ($ this ->shouldCollect ('db ' , true ) && isset ($ this -> app ['db ' ]) && $ events ) {
296+ if ($ this ->shouldCollect ('db ' , true ) && isset ($ app ['db ' ]) && $ events ) {
296297 if (
297- $ debugbar ->hasCollector ('time ' ) && $ this ->app ['config ' ]->get (
298- 'debugbar.options.db.timeline ' ,
299- false
300- )
301- ) {
298+ $ debugbar ->hasCollector ('time ' ) && $ config ->get ('debugbar.options.db.timeline ' , false )) {
302299 $ timeCollector = $ debugbar ->getCollector ('time ' );
303300 } else {
304301 $ timeCollector = null ;
305302 }
306303 $ queryCollector = new QueryCollector ($ timeCollector );
307304
308305 $ queryCollector ->setDataFormatter (new QueryFormatter ());
309- $ queryCollector ->setLimits ($ this ->app ['config ' ]->get ('debugbar.options.db.soft_limit ' ), $ this ->app ['config ' ]->get ('debugbar.options.db.hard_limit ' ));
310- if ($ this ->app ['config ' ]->get ('debugbar.options.db.with_params ' )) {
306+ $ queryCollector ->setLimits ($ config ->get ('debugbar.options.db.soft_limit ' ), $ config ->get ('debugbar.options.db.hard_limit ' ));
307+ $ queryCollector ->setDurationBackground ($ config ->get ('debugbar.options.db.duration_background ' ));
308+
309+ if ($ config ->get ('debugbar.options.db.with_params ' )) {
311310 $ queryCollector ->setRenderSqlWithParams (true );
312311 }
313312
314- if ($ this -> app [ ' config ' ] ->get ('debugbar.options.db.backtrace ' )) {
315- $ middleware = ! $ this ->is_lumen ? $ this -> app ['router ' ]->getMiddleware () : [];
313+ if ($ config ->get ('debugbar.options.db.backtrace ' )) {
314+ $ middleware = ! $ this ->is_lumen ? $ app ['router ' ]->getMiddleware () : [];
316315 $ queryCollector ->setFindSource (true , $ middleware );
317316 }
318317
319- if ($ this ->app ['config ' ]->get ('debugbar.options.db.backtrace_exclude_paths ' )) {
320- $ excludePaths = $ this ->app ['config ' ]->get ('debugbar.options.db.backtrace_exclude_paths ' );
318+ if ($ excludePaths = $ config ->get ('debugbar.options.db.backtrace_exclude_paths ' )) {
321319 $ queryCollector ->mergeBacktraceExcludePaths ($ excludePaths );
322320 }
323321
324- $ queryCollector ->setDurationBackground ($ this ->app ['config ' ]->get ('debugbar.options.db.duration_background ' ));
325-
326- if ($ this ->app ['config ' ]->get ('debugbar.options.db.explain.enabled ' )) {
327- $ types = $ this ->app ['config ' ]->get ('debugbar.options.db.explain.types ' );
322+ if ($ config ->get ('debugbar.options.db.explain.enabled ' )) {
323+ $ types = $ config ->get ('debugbar.options.db.explain.types ' );
328324 $ queryCollector ->setExplainSource (true , $ types );
329325 }
330326
331- if ($ this -> app [ ' config ' ] ->get ('debugbar.options.db.hints ' , true )) {
327+ if ($ config ->get ('debugbar.options.db.hints ' , true )) {
332328 $ queryCollector ->setShowHints (true );
333329 }
334330
335- if ($ this -> app [ ' config ' ] ->get ('debugbar.options.db.show_copy ' , false )) {
331+ if ($ config ->get ('debugbar.options.db.show_copy ' , false )) {
336332 $ queryCollector ->setShowCopyButton (true );
337333 }
338334
@@ -444,13 +440,13 @@ function (\Illuminate\Database\Events\ConnectionEstablished $event) use ($queryC
444440 $ mailCollector ->addSymfonyMessage ($ event ->sent ->getSymfonySentMessage ());
445441 });
446442
447- if ($ this -> app [ ' config ' ] ->get ('debugbar.options.mail.full_log ' )) {
443+ if ($ config ->get ('debugbar.options.mail.full_log ' )) {
448444 $ mailCollector ->showMessageDetail ();
449445 }
450446
451- if ($ debugbar ->hasCollector ('time ' ) && $ this -> app [ ' config ' ] ->get ('debugbar.options.mail.timeline ' )) {
452- $ transport = $ this -> app ['mailer ' ]->getSymfonyTransport ();
453- $ this -> app ['mailer ' ]->setSymfonyTransport (new class ($ transport , $ this ) extends AbstractTransport{
447+ if ($ debugbar ->hasCollector ('time ' ) && $ config ->get ('debugbar.options.mail.timeline ' )) {
448+ $ transport = $ app ['mailer ' ]->getSymfonyTransport ();
449+ $ app ['mailer ' ]->setSymfonyTransport (new class ($ transport , $ this ) extends AbstractTransport{
454450 private $ originalTransport ;
455451 private $ laravelDebugbar ;
456452
@@ -485,7 +481,7 @@ public function __toString(): string
485481
486482 if ($ this ->shouldCollect ('logs ' , false )) {
487483 try {
488- $ file = $ this -> app [ ' config ' ] ->get ('debugbar.options.logs.file ' );
484+ $ file = $ config ->get ('debugbar.options.logs.file ' );
489485 $ this ->addCollector (new LogsCollector ($ file ));
490486 } catch (Exception $ e ) {
491487 $ this ->addCollectorException ('Cannot add LogsCollector ' , $ e );
@@ -497,11 +493,11 @@ public function __toString(): string
497493
498494 if ($ this ->shouldCollect ('auth ' , false )) {
499495 try {
500- $ guards = $ this -> app [ ' config ' ] ->get ('auth.guards ' , []);
496+ $ guards = $ config ->get ('auth.guards ' , []);
501497 $ authCollector = new MultiAuthCollector ($ app ['auth ' ], $ guards );
502498
503499 $ authCollector ->setShowName (
504- $ this -> app [ ' config ' ] ->get ('debugbar.options.auth.show_name ' )
500+ $ config ->get ('debugbar.options.auth.show_name ' )
505501 );
506502 $ this ->addCollector ($ authCollector );
507503 } catch (Exception $ e ) {
@@ -519,8 +515,8 @@ public function __toString(): string
519515
520516 if ($ this ->shouldCollect ('cache ' , false ) && $ events ) {
521517 try {
522- $ collectValues = $ this -> app [ ' config ' ] ->get ('debugbar.options.cache.values ' , true );
523- $ startTime = $ this -> app ['request ' ]->server ('REQUEST_TIME_FLOAT ' );
518+ $ collectValues = $ config ->get ('debugbar.options.cache.values ' , true );
519+ $ startTime = $ app ['request ' ]->server ('REQUEST_TIME_FLOAT ' );
524520 $ cacheCollector = new CacheCollector ($ startTime , $ collectValues );
525521 $ this ->addCollector ($ cacheCollector );
526522 $ events ->subscribe ($ cacheCollector );
@@ -541,9 +537,9 @@ public function __toString(): string
541537 }
542538
543539 $ renderer = $ this ->getJavascriptRenderer ();
544- $ renderer ->setIncludeVendors ($ this -> app [ ' config ' ] ->get ('debugbar.include_vendors ' , true ));
545- $ renderer ->setBindAjaxHandlerToFetch ($ app [ ' config ' ] ->get ('debugbar.capture_ajax ' , true ));
546- $ renderer ->setBindAjaxHandlerToXHR ($ app [ ' config ' ] ->get ('debugbar.capture_ajax ' , true ));
540+ $ renderer ->setIncludeVendors ($ config ->get ('debugbar.include_vendors ' , true ));
541+ $ renderer ->setBindAjaxHandlerToFetch ($ config ->get ('debugbar.capture_ajax ' , true ));
542+ $ renderer ->setBindAjaxHandlerToXHR ($ config ->get ('debugbar.capture_ajax ' , true ));
547543
548544 $ this ->booted = true ;
549545 }
@@ -697,6 +693,7 @@ public function getJavascriptRenderer($baseUrl = null, $basePath = null)
697693 */
698694 public function modifyResponse (Request $ request , Response $ response )
699695 {
696+ /** @var Application $app */
700697 $ app = $ this ->app ;
701698 if (!$ this ->isEnabled () || $ this ->isDebugbarRequest ()) {
702699 return $ response ;
@@ -718,7 +715,7 @@ public function modifyResponse(Request $request, Response $response)
718715 }
719716
720717 $ sessionHiddens = $ app ['config ' ]->get ('debugbar.options.session.hiddens ' , []);
721- if ($ this -> app ->bound (SessionManager::class)) {
718+ if ($ app ->bound (SessionManager::class)) {
722719
723720 /** @var \Illuminate\Session\SessionManager $sessionManager */
724721 $ sessionManager = $ app ->make (SessionManager::class);
@@ -812,6 +809,7 @@ public function modifyResponse(Request $request, Response $response)
812809 public function isEnabled ()
813810 {
814811 if ($ this ->enabled === null ) {
812+ /** @var \Illuminate\Config\Repository $config */
815813 $ config = $ this ->app ['config ' ];
816814 $ configEnabled = value ($ config ->get ('debugbar.enabled ' ));
817815
@@ -901,6 +899,7 @@ function (&$item) {
901899 */
902900 public function injectDebugbar (Response $ response )
903901 {
902+ /** @var \Illuminate\Config\Repository $config */
904903 $ config = $ this ->app ['config ' ];
905904 $ content = $ response ->getContent ();
906905
@@ -1092,6 +1091,7 @@ protected function isLumen()
10921091 */
10931092 protected function selectStorage (DebugBar $ debugbar )
10941093 {
1094+ /** @var \Illuminate\Config\Repository $config */
10951095 $ config = $ this ->app ['config ' ];
10961096 if ($ config ->get ('debugbar.storage.enabled ' )) {
10971097 $ driver = $ config ->get ('debugbar.storage.driver ' , 'file ' );
0 commit comments