Psr7Request   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matches() 0 3 1
A fetchResponse() 0 3 1
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 1
    protected function fetchResponse(): ResponseInterface
21
    {
22 1
        return $this->sendRequest($this->source);
23
    }
24
25
    /**
26
     * Determine whether the JSON source can be handled
27
     *
28
     * @return bool
29
     */
30 2
    public function matches(): bool
31
    {
32 2
        return $this->source instanceof RequestInterface;
33
    }
34
}
35