UnknownFrameException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 41
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A getFrameType() 0 4 1
A getLength() 0 4 1
1
<?php
2
namespace Hyphper\Frame\Exception;
3
4
/**
5
 * A frame of unknown type was received.
6
 *
7
 * @package Hyphper\Frame
8
 */
9
class UnknownFrameException extends \Exception
10
{
11
    protected $frame_type;
12
    protected $length;
13
14
    /**
15
     * UnknownFrameException constructor.
16
     *
17
     * @param string $frame_type
18
     * @param int $length
19
     */
20 14
    public function __construct($frame_type, $length)
21
    {
22 14
        $this->frame_type = $frame_type;
23 14
        $this->length = $length;
24
25 14
        parent::__construct(
26
            sprintf(
27 14
                "UnknownFrameError: Unknown frame type 0x%X received, length %d bytes",
28
                $frame_type,
29
                $length
30
            )
31
        );
32 14
    }
33
34
    /**
35
     * @return string
36
     */
37 12
    public function getFrameType()
38
    {
39 12
        return $this->frame_type;
40
    }
41
42
    /**
43
     * @return int
44
     */
45 12
    public function getLength()
46
    {
47 12
        return $this->length;
48
    }
49
}
50