Frame::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * Websocket frame
4
 * User: moyo
5
 * Date: 2018/6/27
6
 * Time: 12:18 PM
7
 */
8
9
namespace Carno\HTTP\Client;
10
11
use Carno\HTTP\Contracts\WSOpcode;
12
13
class Frame
14
{
15
    /**
16
     * @var int
17
     */
18
    private $code = null;
19
20
    /**
21
     * @var string
22
     */
23
    private $data = null;
24
25
    /**
26
     * Frame constructor.
27
     * @param string $data
28
     * @param int $code
29
     */
30
    public function __construct(string $data, int $code = WSOpcode::TEXT)
31
    {
32
        $this->code = $code;
33
        $this->data = $data;
34
    }
35
36
    /**
37
     * @return int
38
     */
39
    public function code() : int
40
    {
41
        return $this->code;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function data() : string
48
    {
49
        return $this->data;
50
    }
51
}
52