Skip to content

Commit

Permalink
replace and by &&
Browse files Browse the repository at this point in the history
The and operator does not have the same precedence as &&. This could
lead to unexpected behavior, use && instead.
  • Loading branch information
Tjoosten authored and Tjoosten committed Apr 21, 2015
1 parent 0576b25 commit 40e5cf0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/LaravelDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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'
)
) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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'
) {
Expand Down Expand Up @@ -548,7 +548,7 @@ protected function isDebugbarRequest()
{
return $this->app['request']->segment(1) == '_debugbar';
}

/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @return bool
Expand Down

0 comments on commit 40e5cf0

Please sign in to comment.