Skip to content

Commit

Permalink
replace starts_with & str_contains
Browse files Browse the repository at this point in the history
  • Loading branch information
KABBOUCHI committed Sep 4, 2019
1 parent 691070e commit 6af7f60
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Http/Middleware/Impersonate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace KABBOUCHI\NovaImpersonate\Http\Middleware;

use Illuminate\Support\Str;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
Expand Down Expand Up @@ -30,19 +31,19 @@ public function handle($request, $next)

auth()->check() &&

! ($response instanceof RedirectResponse) &&
!($response instanceof RedirectResponse) &&

! ($response instanceof BinaryFileResponse) &&
!($response instanceof BinaryFileResponse) &&

! ($response instanceof StreamedResponse) &&
!($response instanceof StreamedResponse) &&

! ($response instanceof JsonResponse) &&
!($response instanceof JsonResponse) &&

! $request->expectsJson() &&
!$request->expectsJson() &&

starts_with($response->headers->get('Content-Type'), 'text/html') &&
Str::startsWith($response->headers->get('Content-Type'), 'text/html') &&

! str_contains($request->path(), 'nova-api')
!Str::contains($request->path(), 'nova-api')
) {

/** @var Response $response * */
Expand Down

0 comments on commit 6af7f60

Please sign in to comment.