Passed
Push — master ( 222a88...547f19 )
by Andrea Marco
02:49 queued 12s
created

Psr7Message::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cerbero\LazyJson\Handlers;
4
5
use Psr\Http\Message\MessageInterface;
6
use Traversable;
7
8
/**
9
 * The PSR-7 message handler.
10
 *
11
 */
12
class Psr7Message extends Psr7Stream
13
{
14
    /**
15
     * Determine whether the handler can handle the given source
16
     *
17
     * @param mixed $source
18
     * @return bool
19
     */
20 4
    public function handles($source): bool
21
    {
22 4
        return $source instanceof MessageInterface;
23
    }
24
25
    /**
26
     * Handle the given source
27
     *
28
     * @param mixed $source
29
     * @param string $path
30
     * @return Traversable
31
     */
32 4
    public function handle($source, string $path): Traversable
33
    {
34 4
        return parent::handle($source->getBody(), $path);
35
    }
36
}
37