From 40e5cf02c38efe264cdd75394538d32229de9237 Mon Sep 17 00:00:00 2001 From: Tjoosten Date: Tue, 21 Apr 2015 22:29:59 +0200 Subject: [PATCH] replace and by && The and operator does not have the same precedence as &&. This could lead to unexpected behavior, use && instead. --- src/LaravelDebugbar.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/LaravelDebugbar.php b/src/LaravelDebugbar.php index e73c9c60..714ddcb1 100644 --- a/src/LaravelDebugbar.php +++ b/src/LaravelDebugbar.php @@ -164,7 +164,7 @@ function () use ($debugbar) { $this->addCollector(new RequestDataCollector()); } - if ($this->shouldCollect('events', false) and isset($this->app['events'])) { + if ($this->shouldCollect('events', false) && isset($this->app['events'])) { try { $startTime = defined('LARAVEL_START') ? LARAVEL_START : null; $eventCollector = new EventCollector($startTime); @@ -182,7 +182,7 @@ function () use ($debugbar) { } } - if ($this->shouldCollect('views', true) and isset($this->app['events'])) { + if ($this->shouldCollect('views', true) && isset($this->app['events'])) { try { $collectData = $this->app['config']->get('debugbar.options.views.data', true); $this->addCollector(new ViewCollector($collectData)); @@ -251,7 +251,7 @@ function ($level, $message, $context) use ($logger) { } } - if ($this->shouldCollect('db', true) and isset($this->app['db'])) { + if ($this->shouldCollect('db', true) && isset($this->app['db'])) { $db = $this->app['db']; if ($debugbar->hasCollector('time') && $this->app['config']->get( 'debugbar.options.db.timeline', @@ -305,7 +305,7 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector) try { $mailer = $this->app['mailer']->getSwiftMailer(); $this->addCollector(new SwiftMailCollector($mailer)); - if ($this->app['config']->get('debugbar.options.mail.full_log') and $this->hasCollector( + if ($this->app['config']->get('debugbar.options.mail.full_log') && $this->hasCollector( 'messages' ) ) { @@ -476,7 +476,7 @@ public function modifyResponse($request, $response) } } - if ($this->shouldCollect('symfony_request', true) and !$this->hasCollector('request')) { + if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) { try { $this->addCollector(new SymfonyRequestCollector($request, $response, $sessionManager)); } catch (\Exception $e) { @@ -497,7 +497,7 @@ public function modifyResponse($request, $response) $app['log']->error('Debugbar exception: ' . $e->getMessage()); } } elseif ( - $this->isJsonRequest($request) and + $this->isJsonRequest($request) && $app['config']->get('debugbar.capture_ajax', true) ) { try { @@ -506,7 +506,7 @@ public function modifyResponse($request, $response) $app['log']->error('Debugbar exception: ' . $e->getMessage()); } } elseif ( - ($response->headers->has('Content-Type') and + ($response->headers->has('Content-Type') && strpos($response->headers->get('Content-Type'), 'html') === false) || $request->getRequestFormat() !== 'html' ) { @@ -548,7 +548,7 @@ protected function isDebugbarRequest() { return $this->app['request']->segment(1) == '_debugbar'; } - + /** * @param \Symfony\Component\HttpFoundation\Request $request * @return bool