Completed
Pull Request — master (#28)
by rugk
03:18
created
samples/web/SendTextMessage.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function SendMessage($connector, $threemaId, $message)
40 40
 {
41
-    $e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper(KeyHexToBin(MSGAPI_PRIVATE_KEY), $connector);
42
-    $result = $e2eHelper->sendTextMessage($threemaId, $message);
41
+	$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper(KeyHexToBin(MSGAPI_PRIVATE_KEY), $connector);
42
+	$result = $e2eHelper->sendTextMessage($threemaId, $message);
43 43
 
44
-    if (true === $result->isSuccess()) {
45
-        return $result->getMessageId();
46
-    } else {
47
-        throw new Exception($result->getErrorMessage());
48
-    }
44
+	if (true === $result->isSuccess()) {
45
+		return $result->getMessageId();
46
+	} else {
47
+		throw new Exception($result->getErrorMessage());
48
+	}
49 49
 }
50 50
 
51 51
 //get params
52 52
 if (ReturnGetPost('recieverid') &&
53
-    preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('recieverid'))
53
+	preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('recieverid'))
54 54
 ) {
55
-    $threemaId = htmlentities(ReturnGetPost('recieverid'));
56
-    $message = ReturnGetPost('message');
55
+	$threemaId = htmlentities(ReturnGetPost('recieverid'));
56
+	$message = ReturnGetPost('message');
57 57
 }
58 58
 
59 59
 //create connection
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 
62 62
 //Send message
63 63
 if ($threemaId != null && $message != null) {
64
-    if (!$isIncluded) {
65
-        header('Content-Type: text/plain');
66
-    }
67
-    $actionDone = true;
64
+	if (!$isIncluded) {
65
+		header('Content-Type: text/plain');
66
+	}
67
+	$actionDone = true;
68 68
 
69
-    try {
70
-        $messageId = SendMessage($connector, $threemaId, $message);
71
-    } catch (Exception $e) {
72
-        http_response_code(500);
73
-        $errorMessage = $e->getMessage();
74
-    }
69
+	try {
70
+		$messageId = SendMessage($connector, $threemaId, $message);
71
+	} catch (Exception $e) {
72
+		http_response_code(500);
73
+		$errorMessage = $e->getMessage();
74
+	}
75 75
 }
76 76
 
77 77
 //Show direct output if the file is called directly
78 78
 if (!$isIncluded) {
79
-    if ($errorMessage == null) {
80
-        echo 'Message ID: ' . $messageId;
81
-    } else {
82
-        echo $errorMessage;
83
-    }
79
+	if ($errorMessage == null) {
80
+		echo 'Message ID: ' . $messageId;
81
+	} else {
82
+		echo $errorMessage;
83
+	}
84 84
 }
Please login to merge, or discard this patch.