MakeRequestTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 5 1
1
<?php
2
3
namespace Gravatalonga\Framework\Testing\Traits;
4
5
use Nyholm\Psr7\Request;
6
use Nyholm\Psr7\ServerRequest;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\StreamInterface;
9
10
trait MakeRequestTrait
11
{
12
    /**
13
     * Generate a call to request
14
     *
15
     * @param string $method
16
     * @param string $endpoint
17
     * @param string $body
18
     * @param array $headers
19
     * @param array $serverParams
20
     * @return ResponseInterface
21
     */
22
    public function call(string $method, string $endpoint, string $body = '', array $headers = [], array $serverParams = []) : ResponseInterface
0 ignored issues
show
Unused Code introduced by
The parameter $serverParams is not used and could be removed. ( Ignorable by Annotation )

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

22
    public function call(string $method, string $endpoint, string $body = '', array $headers = [], /** @scrutinizer ignore-unused */ array $serverParams = []) : ResponseInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        $request = new ServerRequest($method, $endpoint, $headers, $body);
25
26
        return $this->app->handle($request);
27
    }
28
}
29