Passed
Push — master ( e9cc93...80c3cf )
by Alexander
04:32
created

NotFoundHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 3 1
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
final class NotFoundHandler implements RequestHandlerInterface
14
{
15
    private ViewRenderer $viewRenderer;
16
17 9
    public function __construct(ViewRenderer $viewRenderer)
18
    {
19 9
        $this->viewRenderer = $viewRenderer->withControllerName('site');
20 9
    }
21
22 1
    public function handle(ServerRequestInterface $request): ResponseInterface
23
    {
24 1
        return $this->viewRenderer->render('404')->withStatus(Status::NOT_FOUND);
25
    }
26
}
27