for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DrMVC\Controllers;
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
class Error
{
public function action_index(Request $request, Response $response, array $args)
$args
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function action_index(Request $request, Response $response, /** @scrutinizer ignore-unused */ array $args)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$request
public function action_index(/** @scrutinizer ignore-unused */ Request $request, Response $response, array $args)
$body = $this->renderHtmlErrorMessage();
$response->getBody()->write($body);
}
/**
* Render HTML error page
*
* @return string
*/
protected function renderHtmlErrorMessage()
$title = 'DrMVC Application Error';
$html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>';
$output = sprintf(
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" .
"<title>%s</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana," .
"sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{" .
"display:inline-block;width:65px;}</style></head><body><h1>%s</h1>%s</body></html>",
$title,
$html
);
return $output;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.