LookupEmail::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
dl 3
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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\LookupIdResult;
12
use Threema\MsgApi\Tools\CryptTool;
13
14 View Code Duplication
class LookupEmail implements CommandInterface {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
	/**
16
	 * @var string
17
	 */
18
	private $emailAddress;
19
20
	/**
21
	 * @param string $emailAddress
22
	 */
23
	public function __construct($emailAddress) {
24
		$this->emailAddress = $emailAddress;
25
	}
26
27
	/**
28
	 * @return string
29
	 */
30
	public function getEmailAddress() {
31
		return $this->emailAddress;
32
	}
33
34
	/**
35
	 * @return array
36
	 */
37
	public function getParams() {
38
		return array();
39
	}
40
41
	/**
42
	 * @return string
43
	 */
44
	public function getPath() {
45
		return 'lookup/email_hash/'.urlencode(CryptTool::getInstance()->hashEmail($this->emailAddress));
46
	}
47
48
	/**
49
	 * @param int $httpCode
50
	 * @param object $res
51
	 * @return LookupIdResult
52
	 */
53
	public function parseResult($httpCode, $res){
54
		return new LookupIdResult($httpCode, $res);
55
	}
56
}
57