for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file handle scope middleware.
*
* @link https://github.com/maab16
* @since 1.0.0
*/
namespace WPB\App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
* The scope middleware class.
* @author Md Abu Ahsan basir <[email protected]>
class Scope
{
* Handle an incoming request.
* @param \Illuminate\Http\Request $request The app http request.
* @param \Closure $next The next closure.
* @param array ...$scopes The requested guards.
* @throws \Exception Throw the exception.
* @return mixed
public function handle(Request $request, Closure $next, ...$scopes)
foreach ($scopes as $scope) {
if (!in_array($scope, $request->scopes)) {
wp_send_json(['msg' => "You don't have enough permission"], 400);
wp_send_json
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
/** @scrutinizer ignore-call */
}
return $next($request);