for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Example;
use GuzzleHttp\Promise\FulfilledPromise;
use Psr\Http\Message\RequestInterface;
class GuzzleTimerMiddleware
{
private $total = 0;
private $start = 0;
public function onRequest(RequestInterface $request, array $options)
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$options
$this->start = microtime(true);
$start
integer
microtime(true)
double
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
}
public function onResponse(RequestInterface $request, array $options, FulfilledPromise $response)
$response
$duration = microtime(true) - $this->start;
$this->total = $this->total + $duration;
$total
$this->total + $duration
public function getTotal()
return round($this->total, 2);
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.