for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Xetaravel\Http\Middleware;
use Closure;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class PackagistVersion
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle(Request $request, Closure $next, string $guard = null): mixed
$guard
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function handle(Request $request, Closure $next, /** @scrutinizer ignore-unused */ string $guard = null): mixed
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$version = Cache::remember(
'Packagist.version',
config('xetaravel.site.packagist_cache_timeout'),
function () {
$client = new Client();
$res = $client->request('GET', config('xetaravel.site.packagist_url'));
if ($res->getStatusCode() !== 200) {
return false;
}
$array = json_decode($res->getBody()->getContents(), true);
return $array['packages']['xetaio/xetaravel'][0]['version'];
);
config(['xetaravel.version' => $version]);
return $next($request);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.