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

NotFoundHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

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

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
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