Completed
Push — master ( 382c63...5355c1 )
by rugk
02:29
created
source/Threema/MsgApi/Commands/Results/LookupIdResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 * @return string
33 33
 	 */
34 34
 	protected function getErrorMessageByErrorCode($httpCode) {
35
-		switch($httpCode) {
35
+		switch ($httpCode) {
36 36
 			case 400:
37 37
 				return 'Hash length is wrong';
38 38
 			case 401:
Please login to merge, or discard this patch.
source/Threema/MsgApi/Commands/Results/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 * @return null|int
37 37
 	 */
38 38
 	final public function getErrorCode() {
39
-		if(false === $this->isSuccess()) {
39
+		if (false === $this->isSuccess()) {
40 40
 			return $this->httpCode;
41 41
 		}
42 42
 		return null;
Please login to merge, or discard this patch.
source/Threema/MsgApi/Commands/Results/SendE2EResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	 * @return string
30 30
 	 */
31 31
 	protected function getErrorMessageByErrorCode($httpCode) {
32
-		switch($httpCode) {
32
+		switch ($httpCode) {
33 33
 			case 400:
34 34
 				return 'The recipient identity is invalid or the account is not set up for E2E mode';
35 35
 			case 401:
Please login to merge, or discard this patch.
source/Threema/MsgApi/Commands/Results/SendSimpleResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	 * @return string
33 33
 	 */
34 34
 	protected function getErrorMessageByErrorCode($httpCode) {
35
-		switch($httpCode) {
35
+		switch ($httpCode) {
36 36
 			case 400:
37 37
 				return 'The recipient identity is invalid or the account is not set up for simple mode';
38 38
 			case 401:
Please login to merge, or discard this patch.
source/Threema/MsgApi/Commands/Results/UploadFileResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 	 * @return string
35 35
 	 */
36 36
 	protected function getErrorMessageByErrorCode($httpCode) {
37
-		switch($httpCode) {
37
+		switch ($httpCode) {
38 38
 			case 401:
39 39
 				return 'API identity or secret incorrect or file is empty';
40 40
 			case 402:
Please login to merge, or discard this patch.
source/Threema/MsgApi/PublicKeyStore.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
 	 * @return string|null
28 28
 	 */
29 29
 	public final function getPublicKey($threemaId) {
30
-		if(array_key_exists($threemaId, $this->cache)) {
30
+		if (array_key_exists($threemaId, $this->cache)) {
31 31
 			return $this->cache[$threemaId];
32 32
 		}
33 33
 
34 34
 		$publicKey = $this->findPublicKey($threemaId);
35
-		if(null !== $publicKey) {
35
+		if (null !== $publicKey) {
36 36
 			$this->cache[$threemaId] = $publicKey;
37 37
 		}
38 38
 		return $publicKey;
Please login to merge, or discard this patch.
source/Threema/MsgApi/PublicKeyStores/PhpFile.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	public function __construct($file)
44 44
 	{
45 45
 		if (false === is_writable($file)) {
46
-			throw new Exception('file ' . $file . ' does not exist or is not writable');
46
+			throw new Exception('file '.$file.' does not exist or is not writable');
47 47
 		}
48 48
 		if (pathinfo($file, PATHINFO_EXTENSION) != 'php') {
49
-			throw new Exception('file ' . $file . ' is not a valid PHP file');
49
+			throw new Exception('file '.$file.' is not a valid PHP file');
50 50
 		}
51 51
 		$this->file = $file;
52 52
 	}
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 
105 105
 		//add key
106 106
 		$this->keystore[$threemaId] = $publicKey;
107
-		$content = '$keystore[\'' . $threemaId . '\'] = \'' . $publicKey . '\';' . PHP_EOL;
107
+		$content = '$keystore[\''.$threemaId.'\'] = \''.$publicKey.'\';'.PHP_EOL;
108 108
 
109 109
 		//write content
110 110
 		$fileadd = file_put_contents($this->file, $content, FILE_APPEND);
111 111
 		if (!$fileadd) {
112
-			throw new Exception('could not write to file ' . $this->file);
112
+			throw new Exception('could not write to file '.$this->file);
113 113
 		}
114 114
 
115 115
 		return true;
@@ -137,28 +137,28 @@  discard block
 block discarded – undo
137 137
 
138 138
 			//check for success
139 139
 			if (null === $fileHandle) {
140
-				throw new Exception('could not open file ' . $this->file);
140
+				throw new Exception('could not open file '.$this->file);
141 141
 			}
142 142
 		}
143 143
 
144 144
 		//create content
145
-		$content = $this->fileBlocker . PHP_EOL;
145
+		$content = $this->fileBlocker.PHP_EOL;
146 146
 		$content .= PHP_EOL;
147
-		$content .= '//Threema MsgApi phpfile keystore' . PHP_EOL;
148
-		$content .= '//DO NOT EDIT THIS FILE!' . PHP_EOL;
147
+		$content .= '//Threema MsgApi phpfile keystore'.PHP_EOL;
148
+		$content .= '//DO NOT EDIT THIS FILE!'.PHP_EOL;
149 149
 		$content .= PHP_EOL;
150 150
 
151 151
 		//write file
152 152
 		$fwrite = fwrite($fileHandle, $content);
153 153
 		if (!$fwrite) {
154
-			throw new Exception('could not write to file ' . $this->file);
154
+			throw new Exception('could not write to file '.$this->file);
155 155
 		}
156 156
 
157 157
 		//close file if necessary
158 158
 		if ($fileopened) {
159 159
 			$fclose = fclose($fileHandle);
160 160
 			if (!$fclose) {
161
-				throw new Exception('error while processing file ' . $this->file);
161
+				throw new Exception('error while processing file '.$this->file);
162 162
 			}
163 163
 		}
164 164
 		return true;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @return PhpFile
171 171
 	 */
172 172
 	public static function create($path) {
173
-		if(false === file_exists($path)) {
173
+		if (false === file_exists($path)) {
174 174
 			//touch
175 175
 			touch($path);
176 176
 		}
Please login to merge, or discard this patch.
source/Threema/MsgApi/Receiver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	 * @throws \InvalidArgumentException
74 74
 	 */
75 75
 	public function getParams() {
76
-		switch($this->type) {
76
+		switch ($this->type) {
77 77
 			case self::TYPE_ID:
78 78
 				$to = $this->type;
79 79
 				$this->value = strtoupper(trim($this->value));
Please login to merge, or discard this patch.
source/Threema/MsgApi/Tools/CryptToolSalt.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return null|string
49 49
 	 */
50 50
 	protected function openBox($box, $recipientPrivateKey, $senderPublicKey, $nonce) {
51
-		$boxPad = str_repeat("\x00", 16) . $box;
51
+		$boxPad = str_repeat("\x00", 16).$box;
52 52
 		try {
53 53
 			$data = Salt::box_open($boxPad, $recipientPrivateKey, $senderPublicKey, $nonce);
54 54
 		} catch (\SaltException $e) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return string as binary
72 72
 	 */
73 73
 	protected function openSecretBox($box, $nonce, $key) {
74
-		$boxPad = str_repeat("\x00", 16) . $box;
74
+		$boxPad = str_repeat("\x00", 16).$box;
75 75
 		$data = Salt::secretbox_open($boxPad, $nonce, $key);
76 76
 
77 77
 		if ($data) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			Salt::decodeInput($nonce),
131 131
 			$key);
132 132
 
133
-		if($data === false) {
133
+		if ($data === false) {
134 134
 			throw new Exception('encryption failed');
135 135
 		}
136 136
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 * @throws Exception
153 153
 	 */
154 154
 	public function validate() {
155
-		if(false === $this->isSupported()) {
155
+		if (false === $this->isSupported()) {
156 156
 			throw new Exception('SALT implementation not supported');
157 157
 		}
158 158
 
159
-		if(PHP_INT_SIZE < 8) {
159
+		if (PHP_INT_SIZE < 8) {
160 160
 			throw new Exception('Pure PHP Crypto implementation requires 64Bit PHP. Please install the libsodium PHP extension.');
161 161
 		}
162 162
 		return true;
Please login to merge, or discard this patch.