Passed
Pull Request — master (#203)
by
unknown
05:16
created

NotFoundHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Handler;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
use Yiisoft\Http\Status;
11
use Yiisoft\Yii\View\ViewRenderer;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\View\ViewRenderer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class NotFoundHandler implements RequestHandlerInterface
14
{
15
    private ViewRenderer $viewRenderer;
16
17 10
    public function __construct(ViewRenderer $viewRenderer)
18
    {
19 10
        $this->viewRenderer = $viewRenderer->withControllerName('site');
20 10
    }
21
22
    public function handle(ServerRequestInterface $request): ResponseInterface
23
    {
24
        return $this->viewRenderer
25
            ->render('404', ['requestedUri' => (string) $request->getUri()])
26
            ->withStatus(Status::NOT_FOUND);
27
    }
28
}
29