Completed
Push — master ( 382c63...5355c1 )
by rugk
02:29
created
samples/testFetchPublicKey.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
 
24 24
 $result = $connector->fetchPublicKey('ECHOECHO');
25
-if($result->isSuccess()) {
26
-	echo 'public key '.$result->getPublicKey() . "\n";
25
+if ($result->isSuccess()) {
26
+	echo 'public key '.$result->getPublicKey()."\n";
27 27
 }
28 28
 else {
29
-	echo 'error '.$result->getErrorMessage() . "\n";
29
+	echo 'error '.$result->getErrorMessage()."\n";
30 30
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
 $result = $connector->fetchPublicKey('ECHOECHO');
25 25
 if($result->isSuccess()) {
26 26
 	echo 'public key '.$result->getPublicKey() . "\n";
27
-}
28
-else {
27
+} else {
29 28
 	echo 'error '.$result->getErrorMessage() . "\n";
30 29
 }
Please login to merge, or discard this patch.
samples/testKeyLookup.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 $connector = new Connection($settings, $publicKeyStore);
22 22
 
23 23
 $result = $connector->keyLookupByPhoneNumber('123456789');
24
-if($result->isSuccess()) {
25
-	echo 'Threema ID found: '.$result->getId() . "\n";
24
+if ($result->isSuccess()) {
25
+	echo 'Threema ID found: '.$result->getId()."\n";
26 26
 }
27 27
 else {
28
-	echo 'Error: '.$result->getErrorMessage() . "\n";
28
+	echo 'Error: '.$result->getErrorMessage()."\n";
29 29
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 $result = $connector->keyLookupByPhoneNumber('123456789');
24 24
 if($result->isSuccess()) {
25 25
 	echo 'Threema ID found: '.$result->getId() . "\n";
26
-}
27
-else {
26
+} else {
28 27
 	echo 'Error: '.$result->getErrorMessage() . "\n";
29 28
 }
Please login to merge, or discard this patch.
samples/testSendE2EFile.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 $senderPrivateKey = "MY_PUBLIC_KEY_IN_BIN";
24 24
 $filePath = "/path/to/my/file.pdf";
25 25
 
26
-$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey,$connector);
26
+$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey, $connector);
27 27
 $result = $e2eHelper->sendFileMessage("TEST1234", $filePath);
28 28
 
29
-if(true === $result->isSuccess()) {
30
-	echo 'File Message ID: '.$result->getMessageId() . "\n";
29
+if (true === $result->isSuccess()) {
30
+	echo 'File Message ID: '.$result->getMessageId()."\n";
31 31
 }
32 32
 else {
33
-	echo 'Error: '.$result->getErrorMessage() . "\n";
33
+	echo 'Error: '.$result->getErrorMessage()."\n";
34 34
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,6 @@
 block discarded – undo
28 28
 
29 29
 if(true === $result->isSuccess()) {
30 30
 	echo 'File Message ID: '.$result->getMessageId() . "\n";
31
-}
32
-else {
31
+} else {
33 32
 	echo 'Error: '.$result->getErrorMessage() . "\n";
34 33
 }
Please login to merge, or discard this patch.
samples/testSendE2EText.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 
23 23
 $senderPrivateKey = "MY_PUBLIC_KEY_IN_BIN";
24 24
 
25
-$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey,$connector);
25
+$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($senderPrivateKey, $connector);
26 26
 $result = $e2eHelper->sendTextMessage("TEST1234", "This is an end-to-end encrypted message");
27 27
 
28
-if(true === $result->isSuccess()) {
29
-	echo 'Message ID: '.$result->getMessageId() . "\n";
28
+if (true === $result->isSuccess()) {
29
+	echo 'Message ID: '.$result->getMessageId()."\n";
30 30
 }
31 31
 else {
32
-	echo 'Error: '.$result->getErrorMessage() . "\n";
32
+	echo 'Error: '.$result->getErrorMessage()."\n";
33 33
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@
 block discarded – undo
27 27
 
28 28
 if(true === $result->isSuccess()) {
29 29
 	echo 'Message ID: '.$result->getMessageId() . "\n";
30
-}
31
-else {
30
+} else {
32 31
 	echo 'Error: '.$result->getErrorMessage() . "\n";
33 32
 }
Please login to merge, or discard this patch.
samples/testSendSimple.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
 	Receiver::TYPE_ID);
28 28
 
29 29
 $result = $connector->sendSimple($receiver, "This is a Test Message");
30
-if($result->isSuccess()) {
31
-	echo 'Message ID: '.$result->getMessageId() . "\n";
30
+if ($result->isSuccess()) {
31
+	echo 'Message ID: '.$result->getMessageId()."\n";
32 32
 }
33 33
 else {
34
-	echo 'Error: '.$result->getErrorMessage() . "\n";
34
+	echo 'Error: '.$result->getErrorMessage()."\n";
35 35
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,6 @@
 block discarded – undo
29 29
 $result = $connector->sendSimple($receiver, "This is a Test Message");
30 30
 if($result->isSuccess()) {
31 31
 	echo 'Message ID: '.$result->getMessageId() . "\n";
32
-}
33
-else {
32
+} else {
34 33
 	echo 'Error: '.$result->getErrorMessage() . "\n";
35 34
 }
Please login to merge, or discard this patch.
source/Threema/Console/Command/Base.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@
 block discarded – undo
103 103
 		if(false === array_key_exists($i, $this->arguments)) {
104 104
 			if(true === $required) {
105 105
 				throw new Exception('no argument at position '.$i.' ('.$pos.')');
106
-			}
107
-			else {
106
+			} else {
108 107
 				return null;
109 108
 			}
110 109
 		}
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return int
70 70
 	 */
71 71
 	public function getAllArgumentsCount() {
72
-		return $this->getRequiredArgumentCount() + (null !== $this->optionalArguments ? count($this->optionalArguments) : 0);
72
+		return $this->getRequiredArgumentCount()+(null !== $this->optionalArguments ? count($this->optionalArguments) : 0);
73 73
 	}
74 74
 
75 75
 	/**
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 	 * @return int
78 78
 	 * @throws \Threema\Core\Exception
79 79
 	 */
80
-	private function getIndexByPos($pos){
80
+	private function getIndexByPos($pos) {
81 81
 		$i = array_search($pos, $this->requiredArguments);
82
-		if(false === $i) {
82
+		if (false === $i) {
83 83
 			$i = array_search($pos, $this->optionalArguments);
84
-			if(false !== $i) {
84
+			if (false !== $i) {
85 85
 				$i += count($this->requiredArguments);
86 86
 			}
87 87
 		}
88
-		if(false === $i) {
88
+		if (false === $i) {
89 89
 			throw new Exception('argument '.$pos.' not found');
90 90
 		}
91 91
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 		$i = $this->getIndexByPos($pos);
102 102
 		$required = $i < count($this->requiredArguments);
103 103
 
104
-		if(false === array_key_exists($i, $this->arguments)) {
105
-			if(true === $required) {
104
+		if (false === array_key_exists($i, $this->arguments)) {
105
+			if (true === $required) {
106 106
 				throw new Exception('no argument at position '.$i.' ('.$pos.')');
107 107
 			}
108 108
 			else {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function getArgumentFile($pos) {
123 123
 		$i = $this->getIndexByPos($pos);
124 124
 
125
-		if(false === is_file($this->arguments[$i])) {
125
+		if (false === is_file($this->arguments[$i])) {
126 126
 			throw new Exception('argument '.$i.' is not a file');
127 127
 		}
128 128
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	public function getArgumentPrivateKey($pos) {
137 137
 		$content = Common::getPrivateKey($this->getArgumentStringOrFileContent($pos));
138 138
 		$cryptTool = CryptTool::getInstance();
139
-		if(null !== $content) {
139
+		if (null !== $content) {
140 140
 			return $cryptTool->hex2bin($content);
141 141
 		}
142 142
 		return null;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	public function getArgumentPublicKey($pos) {
150 150
 		$content = Common::getPublicKey($this->getArgumentStringOrFileContent($pos));
151 151
 		$cryptTool = CryptTool::getInstance();
152
-		if(null !== $content) {
152
+		if (null !== $content) {
153 153
 			return $cryptTool->hex2bin($content);
154 154
 		}
155 155
 		return null;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	private function getArgumentStringOrFileContent($pos) {
163 163
 		$content = $this->getArgument($pos);
164
-		if(file_exists($content)) {
164
+		if (file_exists($content)) {
165 165
 			$content = trim(file_get_contents($content));
166 166
 		}
167 167
 		return $content;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function getArgumentThreemaId($pos) {
175 175
 		$content = $this->getArgument($pos);
176
-		if(null !== $content && strlen($content) == 8) {
176
+		if (null !== $content && strlen($content) == 8) {
177 177
 			return strtoupper($content);
178 178
 		}
179 179
 		return null;
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 	 * @return string
184 184
 	 */
185 185
 	protected function readStdIn() {
186
-		$f = fopen( 'php://stdin', 'r' );
186
+		$f = fopen('php://stdin', 'r');
187 187
 
188 188
 		$lines = array();
189
-		while( $line = trim(fgets($f)) ) {
189
+		while ($line = trim(fgets($f))) {
190 190
 
191
-			if(strlen($line) == 0 || $line == "\n") {
191
+			if (strlen($line) == 0 || $line == "\n") {
192 192
 				continue;
193 193
 			}
194 194
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$argCount = null !== $this->arguments ? count($this->arguments) : 0;
209 209
 
210
-		if($argCount < count($this->requiredArguments)) {
210
+		if ($argCount < count($this->requiredArguments)) {
211 211
 			throw new Exception('invalid count of arguments');
212 212
 		}
213 213
 		$this->doRun();
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	final public function help($shellColors = true) {
221 221
 		$args = array_merge($this->requiredArguments, $this->optionalArguments);
222 222
 
223
-		if(count($args) > 0) {
223
+		if (count($args) > 0) {
224 224
 			$colorPrefix = '';
225 225
 			$colorPostfix = '';
226
-			if(true === $shellColors) {
226
+			if (true === $shellColors) {
227 227
 				$colorPrefix = "\033[0;36m\033[40m";
228 228
 				$colorPostfix = "\033[0m";
229 229
 			}
Please login to merge, or discard this patch.
source/Threema/Console/Command/Capability.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 		Common::required($threemaId, $from, $secret);
38 38
 
39
-		if(strlen($threemaId) != 8) {
39
+		if (strlen($threemaId) != 8) {
40 40
 			throw new Exception('invalid threema id');
41 41
 		}
42 42
 		//define connection settings
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$result = $connector->keyCapability($threemaId);
49 49
 		Common::required($result);
50
-		if($result->isSuccess()) {
50
+		if ($result->isSuccess()) {
51 51
 			Common::l(implode("\n", $result->getCapabilities()));
52 52
 		}
53 53
 		else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
 		Common::required($result);
50 50
 		if($result->isSuccess()) {
51 51
 			Common::l(implode("\n", $result->getCapabilities()));
52
-		}
53
-		else {
52
+		} else {
54 53
 			Common::e($result->getErrorMessage());
55 54
 		}
56 55
 	}
Please login to merge, or discard this patch.
source/Threema/Console/Command/Credits.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
 		$result = $connector->credits();
44 44
 		Common::required($result);
45
-		if($result->isSuccess()) {
45
+		if ($result->isSuccess()) {
46 46
 			Common::l("remaining credits: ".$result->getCredits());
47 47
 		}
48 48
 		else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@
 block discarded – undo
44 44
 		Common::required($result);
45 45
 		if($result->isSuccess()) {
46 46
 			Common::l("remaining credits: ".$result->getCredits());
47
-		}
48
-		else {
47
+		} else {
49 48
 			Common::e($result->getErrorMessage());
50 49
 		}
51 50
 	}
Please login to merge, or discard this patch.
source/Threema/Console/Command/LookupIdByEmail.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
43 43
 		//create a connection
44 44
 		$connector = new Connection($settings, $this->publicKeyStore);
45 45
 
46
-		$result = $connector->keyLookupByEmail($email);;
46
+		$result = $connector->keyLookupByEmail($email); ;
47 47
 		Common::required($result);
48
-		if($result->isSuccess()) {
48
+		if ($result->isSuccess()) {
49 49
 			Common::l($result->getId());
50 50
 		}
51 51
 		else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@
 block discarded – undo
47 47
 		Common::required($result);
48 48
 		if($result->isSuccess()) {
49 49
 			Common::l($result->getId());
50
-		}
51
-		else {
50
+		} else {
52 51
 			Common::e($result->getErrorMessage());
53 52
 		}
54 53
 	}
Please login to merge, or discard this patch.