Skip to content

Commit

Permalink
fix conditional to skip
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomarinho committed Oct 18, 2017
1 parent dce8b4a commit 8b96822
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Middleware/PageSpeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function replace(array $replace, $buffer)
protected function isEnable()
{
$enable = config('laravel-page-speed.enable');
return (is_null($enable))?true: (boolean) $enable ;
return (is_null($enable))?true: (boolean) $enable;
}

/**
Expand All @@ -67,16 +67,13 @@ protected function isEnable()
protected function shouldProcessPageSpeed($request)
{
$patterns = config('laravel-page-speed.skip');
$patterns = (is_null($patterns))?[]: $patterns;

if (! $this->isEnable()) {
return false;
}

if ( !is_array($patterns) ) {
return false;
}

return collect($patterns)->every(function($pattern) use ($request){
return collect($patterns)->every(function ($pattern) use ($request) {
if (!$request->is($pattern)) {
return true;
}
Expand Down

0 comments on commit 8b96822

Please sign in to comment.