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

LaravelClientRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 4
cp 0
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 Illuminate\Http\Client\Request;
6
use Psr\Http\Message\ResponseInterface;
7
8
/**
9
 * The Laravel client request source.
10
 *
11
 * @property-read Request $source
12
 */
13
class LaravelClientRequest extends Psr7Request
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->toPsrRequest());
23
    }
24
25
    /**
26
     * Determine whether the JSON source can be handled
27
     *
28
     * @return bool
29
     */
30
    public function matches(): bool
31
    {
32
        return $this->source instanceof Request;
33
    }
34
}
35