Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 36-62 (lines=27) @@
33
		$this->publicKeyStore = $publicKeyStore;
34
	}
35
36
	protected function doRun() {
37
		$threemaId = $this->getArgument(self::argThreemaId);
38
		$from = $this->getArgument(self::argFrom);
39
		$secret = $this->getArgument(self::argSecret);
40
		$privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
41
42
		$path = $this->getArgumentFile(self::argFile);
43
		$thumbnailPath = $this->getArgument(self::argThumbnail);
44
45
		Common::required($threemaId, $from, $secret, $privateKey, $path);
46
47
		$settings = new ConnectionSettings(
48
			$from,
49
			$secret
50
		);
51
52
		$connector = new Connection($settings, $this->publicKeyStore);
53
		$helper = new E2EHelper($privateKey, $connector);
54
		$result = $helper->sendFileMessage($threemaId, $path, $thumbnailPath);
55
56
		if($result->isSuccess()) {
57
			Common::l('Message ID: '.$result->getMessageId());
58
		}
59
		else {
60
			Common::e('Error: '.$result->getErrorMessage());
61
		}
62
	}
63
}
64

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

@@ 34-60 (lines=27) @@
31
		$this->publicKeyStore = $publicKeyStore;
32
	}
33
34
	protected function doRun() {
35
		$threemaId = $this->getArgument(self::argThreemaId);
36
		$from = $this->getArgument(self::argFrom);
37
		$secret = $this->getArgument(self::argSecret);
38
		$privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
39
40
		$path = $this->getArgumentFile(self::argImageFile);
41
42
		Common::required($threemaId, $from, $secret, $privateKey, $path);
43
44
		$settings = new ConnectionSettings(
45
			$from,
46
			$secret
47
		);
48
49
		$connector = new Connection($settings, $this->publicKeyStore);
50
51
		$helper = new E2EHelper($privateKey, $connector);
52
		$result = $helper->sendImageMessage($threemaId, $path);
53
54
		if($result->isSuccess()) {
55
			Common::l('Message ID: '.$result->getMessageId());
56
		}
57
		else {
58
			Common::e('Error: '.$result->getErrorMessage());
59
		}
60
	}
61
}
62