for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Folk\Controllers;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Folk\Admin;
use Psr7Middlewares\Middleware;
class Error
{
public function __invoke(Request $request, Response $response, Admin $app)
$app
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$format = Middleware\FormatNegotiator::getFormat($request);
$exception = Middleware\ErrorHandler::getException($request);
if (!$exception) {
return $response;
}
if ($format === 'json') {
return json_encode([
'error' => $exception->getMessage()
]);
return $exception->getMessage();
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.