Completed
Push — master ( df8a39...05d4d5 )
by rugk
04:17 queued 01:47
created

SendSimple   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 52
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getText() 0 3 1
A getParams() 0 5 1
A getPath() 0 3 1
A parseResult() 0 3 1
1
<?php
2
/**
3
 * @author Threema GmbH
4
 * @copyright Copyright (c) 2015-2016 Threema GmbH
5
 */
6
7
8
namespace Threema\MsgApi\Commands;
9
10
use Threema\MsgApi\Commands\CommandInterface;
11
use Threema\MsgApi\Commands\Results\SendSimpleResult;
12
use Threema\MsgApi\Receiver;
13
14
class SendSimple implements CommandInterface {
15
	/**
16
	 * @var string
17
	 */
18
	private $text;
19
20
	/**
21
	 * @var \Threema\MsgApi\Receiver
22
	 */
23
	private $receiver;
24
25
	/**
26
	 * @param \Threema\MsgApi\Receiver $receiver
27
	 * @param string $text
28
	 */
29
	public function __construct(Receiver $receiver, $text) {
30
		$this->text = $text;
31
		$this->receiver = $receiver;
32
	}
33
34
	/**
35
	 * @return string
36
	 */
37
	public function getText() {
38
		return $this->text;
39
	}
40
41
	/**
42
	 * @return array
43
	 */
44
	public function getParams() {
45
		$p = $this->receiver->getParams();
46
		$p['text'] = $this->getText();
47
		return $p;
48
	}
49
50
	/**
51
	 * @return string
52
	 */
53
	public function getPath() {
54
		return 'send_simple';
55
	}
56
57
	/**
58
	 * @param int $httpCode
59
	 * @param object $res
60
	 * @return SendSimpleResult
61
	 */
62
	public function parseResult($httpCode, $res){
63
		return new SendSimpleResult($httpCode, $res);
64
	}
65
}
66