Test Failed
Push — master ( fdaa2f...711c23 )
by Derek Stephen
09:23
created

getResponseWithBodyAndStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Bone\View\Middleware;
4
5
use Laminas\Diactoros\Response\HtmlResponse;
0 ignored issues
show
Bug introduced by
The type Laminas\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...
6
use Laminas\Diactoros\Stream;
0 ignored issues
show
Bug introduced by
The type Laminas\Diactoros\Stream 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...
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Server\MiddlewareInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Http\Server\MiddlewareInterface 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...
9
10
abstract class AbstractViewMiddleware implements MiddlewareInterface
11
{
12
    /**
13
     * @param ResponseInterface $response
14
     * @param string $body
15
     * @param int $status
16
     * @return ResponseInterface
17
     */
18
    protected function getResponseWithBodyAndStatus(ResponseInterface $response, string $body, int $status = 200): ResponseInterface
19
    {
20
        $stream = new Stream('php://memory', 'r+');
21
        $stream->write($body);
22
        $response = $response->withStatus($status)->withBody($stream);
23
24
        return $response;
25
    }
26
}