Psr7Message   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 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