@@ -50,7 +50,7 @@ |
||
50 | 50 | * @param object $res |
51 | 51 | * @return LookupIdResult |
52 | 52 | */ |
53 | - public function parseResult($httpCode, $res){ |
|
53 | + public function parseResult($httpCode, $res) { |
|
54 | 54 | return new LookupIdResult($httpCode, $res); |
55 | 55 | } |
56 | 56 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * @return string |
79 | 79 | */ |
80 | 80 | protected function getErrorMessageByErrorCode($httpCode) { |
81 | - switch($httpCode) { |
|
81 | + switch ($httpCode) { |
|
82 | 82 | case 401: |
83 | 83 | return 'API identity or secret incorrect'; |
84 | 84 | case 404: |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * @return string |
79 | 79 | */ |
80 | 80 | protected function getErrorMessageByErrorCode($httpCode) { |
81 | - switch($httpCode) { |
|
81 | + switch ($httpCode) { |
|
82 | 82 | case 401: |
83 | 83 | return 'API identity or secret incorrect'; |
84 | 84 | case 404: |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | require_once("Salt/autoload.php"); |
3 | 3 | |
4 | 4 | //define possibly missing constants |
5 | -defined('CURL_SSLVERSION_DEFAULT') || define('CURL_SSLVERSION_DEFAULT', 0); |
|
6 | -defined('CURL_SSLVERSION_TLSv1') || define('CURL_SSLVERSION_TLSv1', 1); |
|
7 | -defined('CURL_SSLVERSION_TLSv1_1') || define('CURL_SSLVERSION_TLSv1_1', 5); |
|
8 | -defined('CURL_SSLVERSION_TLSv1_2') || define('CURL_SSLVERSION_TLSv1_2', 6); |
|
9 | -defined('CURLOPT_PINNEDPUBLICKEY') || define('CURLOPT_PINNEDPUBLICKEY', 10230); |
|
5 | +defined('CURL_SSLVERSION_DEFAULT') || define('CURL_SSLVERSION_DEFAULT', 0); |
|
6 | +defined('CURL_SSLVERSION_TLSv1') || define('CURL_SSLVERSION_TLSv1', 1); |
|
7 | +defined('CURL_SSLVERSION_TLSv1_1') || define('CURL_SSLVERSION_TLSv1_1', 5); |
|
8 | +defined('CURL_SSLVERSION_TLSv1_2') || define('CURL_SSLVERSION_TLSv1_2', 6); |
|
9 | +defined('CURLOPT_PINNEDPUBLICKEY') || define('CURLOPT_PINNEDPUBLICKEY', 10230); |
|
10 | 10 | |
11 | 11 | //define autoloader |
12 | 12 | $d = dirname(__FILE__); |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | $fileName = ''; |
17 | 17 | if ($lastNsPos = strrpos($className, '\\')) { |
18 | 18 | $namespace = substr($className, 0, $lastNsPos); |
19 | - $className = substr($className, $lastNsPos + 1); |
|
20 | - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
19 | + $className = substr($className, $lastNsPos+1); |
|
20 | + $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
21 | 21 | } |
22 | - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
22 | + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; |
|
23 | 23 | |
24 | - if(true === file_exists( $d.'/'.$fileName)) { |
|
24 | + if (true === file_exists($d.'/'.$fileName)) { |
|
25 | 25 | require $d.'/'.$fileName; |
26 | 26 | } |
27 | 27 | }); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | define('MSGAPI_SDK_FEATURE_LEVEL', $sdkFeatLevel); |
33 | 33 | $cryptTool = Threema\MsgApi\Tools\CryptTool::getInstance(); |
34 | 34 | |
35 | -if(null === $cryptTool) { |
|
35 | +if (null === $cryptTool) { |
|
36 | 36 | throw new \Threema\Core\Exception("no supported crypt-tool"); |
37 | 37 | } |
38 | 38 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $this->assertNotNull($message); |
58 | 58 | $this->assertTrue($message instanceof TextMessage); |
59 | - if($message instanceof TextMessage) { |
|
59 | + if ($message instanceof TextMessage) { |
|
60 | 60 | $this->assertEquals($message->getText(), 'Dies ist eine Testnachricht. äöü'); |
61 | 61 | } |
62 | 62 | }); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | public function testDerivePublicKey() { |
95 | - $this->doTest(function(CryptTool $cryptTool, $prefix){ |
|
95 | + $this->doTest(function(CryptTool $cryptTool, $prefix) { |
|
96 | 96 | $publicKey = $cryptTool->derivePublicKey($cryptTool->hex2bin(Common::getPrivateKey(Constants::myPrivateKey))); |
97 | 97 | $myPublicKey = $cryptTool->hex2bin(Common::getPublicKey(Constants::myPublicKey)); |
98 | 98 | |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | |
166 | 166 | // test different strings when comparing |
167 | 167 | $comparisonResult = []; |
168 | - foreach(array( |
|
169 | - 'length' => [$string1, $string1 . 'a'], |
|
168 | + foreach (array( |
|
169 | + 'length' => [$string1, $string1.'a'], |
|
170 | 170 | 'diff' => [$string1, $string2], |
171 | 171 | 'same' => [$string1, $string1] |
172 | 172 | ) as $testName => $strings) { |
173 | - for ($i=0; $i < 3; $i++) { |
|
173 | + for ($i = 0; $i < 3; $i++) { |
|
174 | 174 | // test run with delay |
175 | 175 | $comparisonResult[$testName][$i] = $cryptTool->stringCompare($strings[0], $strings[1]); |
176 | 176 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function testRemoveVar() { |
192 | 192 | $this->doTest(function(CryptTool $cryptTool, $prefix) { |
193 | - foreach(array( |
|
193 | + foreach (array( |
|
194 | 194 | 'hex' => Constants::myPrivateKeyExtract, |
195 | 195 | 'bin' => $cryptTool->hex2bin(Constants::myPrivateKeyExtract) |
196 | 196 | ) as $key => $testVar) { |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | private function doTest(\Closure $c) { |
207 | - foreach(array( |
|
207 | + foreach (array( |
|
208 | 208 | 'Salt' => CryptTool::createInstance(CryptTool::TYPE_SALT), |
209 | 209 | 'Sodium' => CryptTool::createInstance(CryptTool::TYPE_SODIUM) |
210 | 210 | ) as $key => $instance) { |
211 | 211 | |
212 | - if($instance === null) { |
|
212 | + if ($instance === null) { |
|
213 | 213 | echo $key.": could not instance crypt tool\n"; |
214 | 214 | break; |
215 | 215 | } |