PriorityFrame::parseBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
namespace Hyphper\Frame;
4
5
/**
6
 * The PRIORITY frame specifies the sender-advised priority of a stream. It
7
 * can be sent at any time for an existing stream. This enables
8
 * reprioritisation of existing streams.
9
 *
10
 * @package Hyphper\Frame
11
 */
12
class PriorityFrame extends \Hyphper\Frame implements PriorityInterface
13
{
14
    use PriorityTrait;
15
16
    protected $defined_flags = [];
17
    protected $type = 0x02;
18
    protected $stream_association = self::HAS_STREAM;
19
20
    /**
21
     * @return string
22
     */
23 2
    public function serializeBody(): string
24
    {
25 2
        return $this->serializePriorityData();
26
    }
27
28
    /**
29
     * Given the body of a frame, parses it into frame data. This populates
30
     * the non-header parts of the frame: that is, it does not populate the
31
     * stream ID or flags.
32
     *
33
     * @param string $data
34
     *
35
     * @return void
36
     */
37 2
    public function parseBody(string $data)
38
    {
39 2
        $this->parsePriorityData($data);
40 1
        $this->body_len = strlen($data);
41 1
    }
42
}
43