@@ -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,15 +165,15 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // test different strings when comparing and get time needed |
| 167 | 167 | $result = []; |
| 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 | 173 | $timeStart = microtime(true); |
| 174 | 174 | $comparisonResult = $cryptTool->stringCompare($strings[0], $strings[1]); |
| 175 | 175 | $timeEnd = microtime(true); |
| 176 | - $timeElapsed = $timeEnd - $timeStart; |
|
| 176 | + $timeElapsed = $timeEnd-$timeStart; |
|
| 177 | 177 | |
| 178 | 178 | // echo $prefix.': '.$humanDescr[$testName].': '.$timeElapsed.'; result: '.$comparisonResult.PHP_EOL; |
| 179 | 179 | $result[$testName] = [$timeElapsed, $comparisonResult]; |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | // check timings |
| 190 | 190 | echo 'Timing test results with '.$prefix.':'.PHP_EOL; |
| 191 | - $timingRatio = $result['diff'][0] / $result['same'][0]; |
|
| 192 | - $absoluteDifference = abs($result['diff'][0] - $result['same'][0]); |
|
| 191 | + $timingRatio = $result['diff'][0]/$result['same'][0]; |
|
| 192 | + $absoluteDifference = abs($result['diff'][0]-$result['same'][0]); |
|
| 193 | 193 | echo 'timing ratio: '.$timingRatio.PHP_EOL; |
| 194 | 194 | echo 'absolute difference: '.$absoluteDifference.PHP_EOL; |
| 195 | 195 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function testRemoveVar() { |
| 210 | 210 | $this->doTest(function(CryptTool $cryptTool, $prefix) { |
| 211 | - foreach(array( |
|
| 211 | + foreach (array( |
|
| 212 | 212 | 'hex' => Constants::myPrivateKeyExtract, |
| 213 | 213 | 'bin' => $cryptTool->hex2bin(Constants::myPrivateKeyExtract) |
| 214 | 214 | ) as $key => $testVar) { |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | private function doTest(\Closure $c) { |
| 225 | - foreach(array( |
|
| 225 | + foreach (array( |
|
| 226 | 226 | 'Salt' => CryptTool::createInstance(CryptTool::TYPE_SALT), |
| 227 | 227 | 'Sodium' => CryptTool::createInstance(CryptTool::TYPE_SODIUM) |
| 228 | 228 | ) as $key => $instance) { |
| 229 | 229 | |
| 230 | - if($instance === null) { |
|
| 230 | + if ($instance === null) { |
|
| 231 | 231 | echo $key.": could not instance crypt tool\n"; |
| 232 | 232 | break; |
| 233 | 233 | } |