@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public static function analyse($file) { |
16 | 16 | //check if file exists |
17 | - if(false === file_exists($file)) { |
|
17 | + if (false === file_exists($file)) { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 | |
21 | 21 | //is not a file |
22 | - if(false === is_file($file)) { |
|
22 | + if (false === is_file($file)) { |
|
23 | 23 | return null; |
24 | 24 | } |
25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | |
29 | 29 | $mimeType = null; |
30 | 30 | //mime type getter |
31 | - if(function_exists('finfo_open')) { |
|
31 | + if (function_exists('finfo_open')) { |
|
32 | 32 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
33 | 33 | $mimeType = finfo_file($finfo, $file); |
34 | 34 | } |
35 | - else if(function_exists('mime_content_type')) { |
|
35 | + else if (function_exists('mime_content_type')) { |
|
36 | 36 | $mimeType = mime_content_type($file); |
37 | 37 | } |
38 | 38 | |
39 | 39 | //default mime type |
40 | - if(strlen($mimeType) == 0) { |
|
40 | + if (strlen($mimeType) == 0) { |
|
41 | 41 | //default mime type |
42 | 42 | $mimeType = 'application/octet-stream'; |
43 | 43 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | //disallow using the cli tool in a web project |
9 | 9 | if ('cli' !== php_sapi_name() || null === $argv) { |
10 | 10 | //file not called from the cli |
11 | - die('please run ' . basename(__FILE__) . ' only in a cli. '. |
|
11 | + die('please run '.basename(__FILE__).' only in a cli. '. |
|
12 | 12 | 'To use the threema msgapi sdk in your web project, include the source/bootstrap.php or the threema_msgapi.phar file.'); |
13 | 13 | } |
14 | 14 | try { |
@@ -20,6 +20,6 @@ discard block |
||
20 | 20 | Threema\MsgApi\PublicKeyStores\PhpFile::create('keystore.php')); |
21 | 21 | $tool->run(); |
22 | 22 | } catch (\Threema\Core\Exception $exception) { |
23 | - echo "ERROR: " . $exception->getMessage() . "\n"; |
|
23 | + echo "ERROR: ".$exception->getMessage()."\n"; |
|
24 | 24 | die(); |
25 | 25 | } |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | } |
203 | 203 | } |
204 | 204 | if ($tlsCipher = $this->setting->getTlsOption(ConnectionSettings::tlsOptionCipher, null)) { |
205 | - if(true === is_string($tlsCipher)) { |
|
205 | + if (true === is_string($tlsCipher)) { |
|
206 | 206 | $options[CURLOPT_SSL_CIPHER_LIST] = $tlsCipher; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | if ($pinnedKey = $this->setting->getTlsOption(ConnectionSettings::tlsOptionPinnedKey, Constants::DEFAULT_PINNED_KEY)) { |
210 | - if(true === is_string($pinnedKey)) { |
|
210 | + if (true === is_string($pinnedKey)) { |
|
211 | 211 | $options[CURLOPT_PINNEDPUBLICKEY] = $pinnedKey; |
212 | 212 | } |
213 | 213 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | return $this->call($command->getPath(), |
240 | 240 | $this->createDefaultOptions($progress), |
241 | 241 | $params, |
242 | - function ($httpCode, $response) use ($command) { |
|
242 | + function($httpCode, $response) use ($command) { |
|
243 | 243 | return $command->parseResult($httpCode, $response); |
244 | 244 | }); |
245 | 245 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $options[CURLOPT_HTTPHEADER] = array( |
258 | 258 | 'Content-Type: application/x-www-form-urlencoded'); |
259 | 259 | |
260 | - return $this->call($command->getPath(), $options, null, function ($httpCode, $response) use ($command) { |
|
260 | + return $this->call($command->getPath(), $options, null, function($httpCode, $response) use ($command) { |
|
261 | 261 | return $command->parseResult($httpCode, $response); |
262 | 262 | }); |
263 | 263 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | 'blob' => $command->getData() |
278 | 278 | ); |
279 | 279 | |
280 | - return $this->call($command->getPath(), $options, $params, function ($httpCode, $response) use ($command) { |
|
280 | + return $this->call($command->getPath(), $options, $params, function($httpCode, $response) use ($command) { |
|
281 | 281 | return $command->parseResult($httpCode, $response); |
282 | 282 | }); |
283 | 283 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | $response = curl_exec($session); |
306 | 306 | if (false === $response) { |
307 | - throw new Exception($path . ' ' . curl_error($session)); |
|
307 | + throw new Exception($path.' '.curl_error($session)); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | $httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE); |
@@ -49,20 +49,20 @@ |
||
49 | 49 | $this->host = $host; |
50 | 50 | |
51 | 51 | // TLS options |
52 | - if(null !== $tlsOptions && is_array($tlsOptions)) { |
|
53 | - if(true === array_key_exists(self::tlsOptionForceHttps, $tlsOptions)) { |
|
52 | + if (null !== $tlsOptions && is_array($tlsOptions)) { |
|
53 | + if (true === array_key_exists(self::tlsOptionForceHttps, $tlsOptions)) { |
|
54 | 54 | $this->tlsOptions[self::tlsOptionForceHttps] = $tlsOptions[self::tlsOptionForceHttps] === true; |
55 | 55 | } |
56 | 56 | |
57 | - if(true === array_key_exists(self::tlsOptionVersion, $tlsOptions)) { |
|
57 | + if (true === array_key_exists(self::tlsOptionVersion, $tlsOptions)) { |
|
58 | 58 | $this->tlsOptions[self::tlsOptionVersion] = $tlsOptions[self::tlsOptionVersion]; |
59 | 59 | } |
60 | 60 | |
61 | - if(true === array_key_exists(self::tlsOptionCipher, $tlsOptions)) { |
|
61 | + if (true === array_key_exists(self::tlsOptionCipher, $tlsOptions)) { |
|
62 | 62 | $this->tlsOptions[self::tlsOptionCipher] = $tlsOptions[self::tlsOptionCipher]; |
63 | 63 | } |
64 | 64 | |
65 | - if(true === array_key_exists(self::tlsOptionPinnedKey, $tlsOptions)) { |
|
65 | + if (true === array_key_exists(self::tlsOptionPinnedKey, $tlsOptions)) { |
|
66 | 66 | $this->tlsOptions[self::tlsOptionPinnedKey] = $tlsOptions[self::tlsOptionPinnedKey]; |
67 | 67 | } |
68 | 68 | } |
@@ -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 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param object $res |
60 | 60 | * @return SendSimpleResult |
61 | 61 | */ |
62 | - public function parseResult($httpCode, $res){ |
|
62 | + public function parseResult($httpCode, $res) { |
|
63 | 63 | return new SendSimpleResult($httpCode, $res); |
64 | 64 | } |
65 | 65 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @param object $res |
44 | 44 | * @return UploadFileResult |
45 | 45 | */ |
46 | - public function parseResult($httpCode, $res){ |
|
46 | + public function parseResult($httpCode, $res) { |
|
47 | 47 | return new DownloadFileResult($httpCode, $res); |
48 | 48 | } |
49 | 49 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * @param object $res |
43 | 43 | * @return FetchPublicKeyResult |
44 | 44 | */ |
45 | - public function parseResult($httpCode, $res){ |
|
45 | + public function parseResult($httpCode, $res) { |
|
46 | 46 | return new FetchPublicKeyResult($httpCode, $res); |
47 | 47 | } |
48 | 48 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param object $res |
50 | 50 | * @return UploadFileResult |
51 | 51 | */ |
52 | - public function parseResult($httpCode, $res){ |
|
52 | + public function parseResult($httpCode, $res) { |
|
53 | 53 | return new UploadFileResult($httpCode, $res); |
54 | 54 | } |
55 | 55 | } |