@@ -76,7 +76,7 @@ |
||
| 76 | 76 | * @param object $res |
| 77 | 77 | * @return SendE2EResult |
| 78 | 78 | */ |
| 79 | - public function parseResult($httpCode, $res){ |
|
| 79 | + public function parseResult($httpCode, $res) { |
|
| 80 | 80 | return new SendE2EResult($httpCode, $res); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | * @param object $res |
| 77 | 77 | * @return SendE2EResult |
| 78 | 78 | */ |
| 79 | - public function parseResult($httpCode, $res){ |
|
| 79 | + public function parseResult($httpCode, $res) { |
|
| 80 | 80 | return new SendE2EResult($httpCode, $res); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | * @param object $res |
| 77 | 77 | * @return SendE2EResult |
| 78 | 78 | */ |
| 79 | - public function parseResult($httpCode, $res){ |
|
| 79 | + public function parseResult($httpCode, $res) { |
|
| 80 | 80 | return new SendE2EResult($httpCode, $res); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -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 | |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | $timeElapsed = []; |
| 168 | 168 | $comparisonResult = []; |
| 169 | 169 | $timeElapsedAvg = []; |
| 170 | - foreach(array( |
|
| 171 | - 'length' => [$string1, $string1 . 'a'], |
|
| 170 | + foreach (array( |
|
| 171 | + 'length' => [$string1, $string1.'a'], |
|
| 172 | 172 | 'diff' => [$string1, $string2], |
| 173 | 173 | 'same' => [$string1, $string1] |
| 174 | 174 | ) as $testName => $strings) { |
| 175 | 175 | $timeMin = [null, 0]; |
| 176 | 176 | $timeMax = [null, 0]; |
| 177 | - for ($i=0; $i < 3; $i++) { |
|
| 177 | + for ($i = 0; $i < 3; $i++) { |
|
| 178 | 178 | // test run with delay |
| 179 | 179 | $timeElapsed[$testName][$i] = -microtime(true); |
| 180 | 180 | $comparisonResult[$testName][$i] = $cryptTool->stringCompare($strings[0], $strings[1]); |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | array_splice($timeElapsed[$testName], $timeMax[1] >= $timeMin[1] ? ($timeMax[1]-1) : $timeMax[1], 1); |
| 208 | 208 | |
| 209 | 209 | // calculate average (currently useless as there is only one value left, but it may be useful later) |
| 210 | - $timeElapsedAvg[$testName] = array_sum($timeElapsed[$testName]) / count($timeElapsed[$testName]); |
|
| 210 | + $timeElapsedAvg[$testName] = array_sum($timeElapsed[$testName])/count($timeElapsed[$testName]); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // check timings |
| 214 | 214 | echo 'Timing test results with '.$prefix.':'.PHP_EOL; |
| 215 | - $timingRatio = $timeElapsedAvg['diff'] / $timeElapsedAvg['same']; |
|
| 216 | - $absoluteDifference = abs($timeElapsedAvg['diff'] - $timeElapsedAvg['same']); |
|
| 215 | + $timingRatio = $timeElapsedAvg['diff']/$timeElapsedAvg['same']; |
|
| 216 | + $absoluteDifference = abs($timeElapsedAvg['diff']-$timeElapsedAvg['same']); |
|
| 217 | 217 | echo 'timing ratio: '.$timingRatio.PHP_EOL; |
| 218 | 218 | echo 'absolute difference: '.$absoluteDifference.PHP_EOL; |
| 219 | 219 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $allowedDifferenceLow = 0.25; |
| 222 | 222 | $allowedDifferenceTop = 0.5; |
| 223 | 223 | // double value if running in a CI envoriment |
| 224 | - if (getenv('CI') == 'true') { |
|
| 224 | + if (getenv('CI') == 'true') { |
|
| 225 | 225 | $allowedDifferenceLow = $allowedDifferenceLow*2; |
| 226 | 226 | $allowedDifferenceTop = $allowedDifferenceTop*2; |
| 227 | 227 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function testRemoveVar() { |
| 241 | 241 | $this->doTest(function(CryptTool $cryptTool, $prefix) { |
| 242 | - foreach(array( |
|
| 242 | + foreach (array( |
|
| 243 | 243 | 'hex' => Constants::myPrivateKeyExtract, |
| 244 | 244 | 'bin' => $cryptTool->hex2bin(Constants::myPrivateKeyExtract) |
| 245 | 245 | ) as $key => $testVar) { |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | private function doTest(\Closure $c) { |
| 256 | - foreach(array( |
|
| 256 | + foreach (array( |
|
| 257 | 257 | 'Salt' => CryptTool::createInstance(CryptTool::TYPE_SALT), |
| 258 | 258 | 'Sodium' => CryptTool::createInstance(CryptTool::TYPE_SODIUM) |
| 259 | 259 | ) as $key => $instance) { |
| 260 | 260 | |
| 261 | - if($instance === null) { |
|
| 261 | + if ($instance === null) { |
|
| 262 | 262 | echo $key.": could not instance crypt tool\n"; |
| 263 | 263 | break; |
| 264 | 264 | } |