ImageMessage::getLength()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author Threema GmbH
4
 * @copyright Copyright (c) 2015-2016 Threema GmbH
5
 */
6
7
8
namespace Threema\MsgApi\Messages;
9
10
class ImageMessage extends ThreemaMessage {
11
	const TYPE_CODE = 0x02;
12
13
	/**
14
	 * @var string
15
	 */
16
	private $blobId;
17
18
	/**
19
	 * @var string
20
	 */
21
	private $length;
22
23
	/**
24
	 * @var int
25
	 */
26
	private $nonce;
27
28
	/**
29
	 * @param string $blobId
30
	 * @param int $length
31
	 * @param string $nonce
32
	 */
33
	public function __construct($blobId, $length, $nonce) {
34
		$this->blobId = $blobId;
35
		$this->length = $length;
0 ignored issues
show
Documentation Bug introduced by
The property $length was declared of type string, but $length is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
36
		$this->nonce = $nonce;
0 ignored issues
show
Documentation Bug introduced by
The property $nonce was declared of type integer, but $nonce is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
37
	}
38
39
	/**
40
	 * @return string
41
	 */
42
	public function getBlobId() {
43
		return $this->blobId;
44
	}
45
46
	/**
47
	 * @return string
48
	 */
49
	public function getLength() {
50
		return $this->length;
51
	}
52
53
	/**
54
	 * @return int
55
	 */
56
	public function getNonce() {
57
		return $this->nonce;
58
	}
59
60
	/**
61
	 * @return string
62
	 */
63
	public function __toString() {
64
		return 'image message';
65
	}
66
67
	/**
68
	 * Get the message type code of this message.
69
	 *
70
	 * @return int message type code
71
	 */
72
	public final function getTypeCode() {
73
		return self::TYPE_CODE;
74
	}
75
}
76