Frame   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 56
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A __toString() 0 10 1
1
<?php
2
namespace evseevnn\Cassandra\Protocol;
3
4
class Frame {
5
6
	/**
7
	 * @var int
8
	 */
9
	private $version;
10
11
	/**
12
	 * @var int
13
	 */
14
	private $opcode;
15
16
	/**
17
	 * @var string
18
	 */
19
	private $body;
20
21
	/**
22
	 * @var int
23
	 */
24
	private $stream;
25
26
	/**
27
	 * @var int
28
	 */
29
	private $flags;
30
31
	/**
32
	 * @param int $version
33
	 * @param int $opcode
34
	 * @param string $body
35
	 * @param int $stream
36
	 * @param int $flags
37
	 */
38
	public function __construct($version, $opcode, $body, $stream = 0, $flags = 0) {
39
		$this->version = $version;
40
		$this->opcode = $opcode;
41
		$this->body = $body;
42
		$this->stream = $stream;
43
		$this->flags = $flags;
44
	}
45
46
	/**
47
	 * @return string
48
	 */
49
	public function __toString() {
50
		return pack(
51
			'CCcCN',
52
			$this->version,
53
			$this->flags,
54
			$this->stream,
55
			$this->opcode,
56
			strlen($this->body)
57
		) . $this->body;
58
	}
59
}