LaravelClientResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handles() 0 3 1
A handle() 0 3 1
1
<?php
2
3
namespace Cerbero\LazyJson\Handlers;
4
5
use Illuminate\Http\Client\Response;
6
use Traversable;
7
8
/**
9
 * The Laravel HTTP client response handler.
10
 *
11
 */
12
class LaravelClientResponse extends Psr7Message
13
{
14
    /**
15
     * Determine whether the handler can handle the given source
16
     *
17
     * @param mixed $source
18
     * @return bool
19
     */
20 5
    public function handles($source): bool
21
    {
22 5
        return $source instanceof Response;
23
    }
24
25
    /**
26
     * Handle the given source
27
     *
28
     * @param mixed $source
29
     * @param string $path
30
     * @return Traversable
31
     */
32 1
    public function handle($source, string $path): Traversable
33
    {
34 1
        return parent::handle($source->toPsrResponse(), $path);
35
    }
36
}
37