Completed
Pull Request — master (#28)
by rugk
02:50
created
samples/web/SendE2EText.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+	 * @author rugk
4
+	 * @copyright Copyright (c) 2015 rugk
5
+	 * @license MIT
6
+	 */
7 7
 
8 8
 header('Content-Type: text/plain');
9 9
 
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function SendText($connector, $receiverId, $message)
33 33
 {
34
-    //get private key
35
-    $privateKey = KeyHexToBin(MSGAPI_PRIVATE_KEY);
36
-
37
-    //send message
38
-    $e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($privateKey, $connector);
39
-    $result = $e2eHelper->sendTextMessage($receiverId, $message);
40
-
41
-    //show result
42
-    if (true === $result->isSuccess()) {
43
-    	echo 'Message ID: '.$result->getMessageId() . "\n";
44
-    } else {
45
-    	echo 'Error: '.$result->getErrorMessage() . "\n";
46
-    }
34
+	//get private key
35
+	$privateKey = KeyHexToBin(MSGAPI_PRIVATE_KEY);
36
+
37
+	//send message
38
+	$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($privateKey, $connector);
39
+	$result = $e2eHelper->sendTextMessage($receiverId, $message);
40
+
41
+	//show result
42
+	if (true === $result->isSuccess()) {
43
+		echo 'Message ID: '.$result->getMessageId() . "\n";
44
+	} else {
45
+		echo 'Error: '.$result->getErrorMessage() . "\n";
46
+	}
47 47
 
48 48
 }
49 49
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
 
41 41
     //show result
42 42
     if (true === $result->isSuccess()) {
43
-    	echo 'Message ID: '.$result->getMessageId() . "\n";
43
+    	echo 'Message ID: '.$result->getMessageId()."\n";
44 44
     } else {
45
-    	echo 'Error: '.$result->getErrorMessage() . "\n";
45
+    	echo 'Error: '.$result->getErrorMessage()."\n";
46 46
     }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
samples/web/include/PublicKey.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function KeyCheck($publicKey, $suffix = '')
16 16
 {
17
-    // RegExp: https://regex101.com/r/sU5tC8/1
18
-    return preg_match('/^(' . $suffix . ')?[[:alnum:]]{64}$/', $publicKey);
17
+	// RegExp: https://regex101.com/r/sU5tC8/1
18
+	return preg_match('/^(' . $suffix . ')?[[:alnum:]]{64}$/', $publicKey);
19 19
 }
20 20
 
21 21
 /**
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function KeyGetUserDisplay($publicKey)
34 34
 {
35
-    //force key to be binary
36
-    if (ctype_alnum($publicKey)) {
37
-        $publicKey = KeyHexToBin($publicKey);
38
-    }
35
+	//force key to be binary
36
+	if (ctype_alnum($publicKey)) {
37
+		$publicKey = KeyHexToBin($publicKey);
38
+	}
39 39
 
40
-    //create short hash
41
-    $shortHash = substr(hash('sha256', $publicKey, 0, 32));
42
-    return $shortHash;
40
+	//create short hash
41
+	$shortHash = substr(hash('sha256', $publicKey, 0, 32));
42
+	return $shortHash;
43 43
 }
44 44
 
45 45
 /**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function KeyHexToBin($keyHex)
53 53
 {
54
-    //delete prefix
55
-    $keyTypeCheck = substr($keyHex, 0, 8);
56
-    if ($keyTypeCheck == 'private:' || $keyTypeCheck == 'public:') {
57
-        $keyHex = substr($keyHex, 8);
58
-    }
54
+	//delete prefix
55
+	$keyTypeCheck = substr($keyHex, 0, 8);
56
+	if ($keyTypeCheck == 'private:' || $keyTypeCheck == 'public:') {
57
+		$keyHex = substr($keyHex, 8);
58
+	}
59 59
 
60
-    //convert key
61
-    $keyBin = hex2bin($keyHex);
62
-    return $keyBin;
60
+	//convert key
61
+	$keyBin = hex2bin($keyHex);
62
+	return $keyBin;
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 function KeyCheck($publicKey, $suffix = '')
16 16
 {
17 17
     // RegExp: https://regex101.com/r/sU5tC8/1
18
-    return preg_match('/^(' . $suffix . ')?[[:alnum:]]{64}$/', $publicKey);
18
+    return preg_match('/^('.$suffix.')?[[:alnum:]]{64}$/', $publicKey);
19 19
 }
20 20
 
21 21
 /**
Please login to merge, or discard this patch.