Code Duplication    Length = 16-16 lines in 2 locations

source/Threema/Console/Command/HashEmail.php 1 location

@@ 13-28 (lines=16) @@
10
use Threema\Console\Common;
11
use Threema\MsgApi\Tools\CryptTool;
12
13
class HashEmail extends Base {
14
	const argEmail = 'email';
15
16
	public function __construct() {
17
		parent::__construct('Hash Email Address',
18
			array(self::argEmail),
19
			'Hash an email address for identity lookup. Prints the hash in hex.');
20
	}
21
22
	protected function doRun() {
23
		$email = $this->getArgument(self::argEmail);
24
		Common::required($email);
25
		$hashedEmail = CryptTool::getInstance()->hashEmail($email);
26
		Common::l($hashedEmail);
27
	}
28
}
29

source/Threema/Console/Command/HashPhone.php 1 location

@@ 13-28 (lines=16) @@
10
use Threema\Console\Common;
11
use Threema\MsgApi\Tools\CryptTool;
12
13
class HashPhone extends Base {
14
	const argPhoneNo = 'phoneNo';
15
16
	public function __construct() {
17
		parent::__construct('Hash Phone Number',
18
			array(self::argPhoneNo),
19
			'Hash a phone number for identity lookup. Prints the hash in hex.');
20
	}
21
22
	protected function doRun() {
23
		$phoneNo = $this->getArgument(self::argPhoneNo);
24
		Common::required($phoneNo);
25
		$hashedPhoneNo = CryptTool::getInstance()->hashPhoneNo($phoneNo);
26
		Common::l($hashedPhoneNo);
27
	}
28
}
29