Passed
Branch feature/first-release (4212f2)
by Andrea Marco
10:46
created

Psr7Request::response()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.037

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 2
cts 3
cp 0.6667
crap 1.037
rs 10
1
<?php
2
3
namespace Cerbero\JsonParser\Sources;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
/**
9
 * The PSR-7 request source.
10
 *
11
 * @property-read RequestInterface $source
12
 */
13
class Psr7Request extends Endpoint
14
{
15
    /**
16
     * Retrieve the fetched HTTP response
17
     *
18
     * @return ResponseInterface
19
     */
20
    protected function fetchResponse(): ResponseInterface
21
    {
22
        return $this->sendRequest($this->source);
23
    }
24
25
    /**
26
     * Determine whether the JSON source can be handled
27
     *
28
     * @return bool
29
     */
30 1
    public function matches(): bool
31
    {
32 1
        return $this->source instanceof RequestInterface;
33
    }
34
}
35