RouteNotFoundMiddleware   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React\PSR15\Middleware;
6
7
use Antidot\React\PSR15\Response\PromiseResponse;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Psr\Http\Server\MiddlewareInterface;
11
use Psr\Http\Server\RequestHandlerInterface;
12
use React\Promise\FulfilledPromise;
13
use Zend\Diactoros\Response\HtmlResponse;
0 ignored issues
show
Bug introduced by
The type Zend\Diactoros\Response\HtmlResponse 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...
14
15
final class RouteNotFoundMiddleware implements MiddlewareInterface
16
{
17
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
18
    {
19
        $promise = new FulfilledPromise();
0 ignored issues
show
Deprecated Code introduced by
The class React\Promise\FulfilledPromise has been deprecated: 2.8.0 External usage of FulfilledPromise is deprecated, use `resolve()` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

19
        $promise = /** @scrutinizer ignore-deprecated */ new FulfilledPromise();
Loading history...
20
21
        return new PromiseResponse($promise->then(function () {
22
            return new HtmlResponse('<html><head></head><body>Page not found</body></html>', 404);
23
        }));
24
    }
25
}
26