Passed
Push — master ( 16a622...8adf29 )
by Alexander
04:44
created

NotFoundHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
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->render('404')->withStatus(Status::NOT_FOUND);
25
    }
26
}
27