These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | #!/usr/bin/env php |
||
2 | <?php |
||
3 | /** |
||
4 | * @author Threema GmbH |
||
5 | * @copyright Copyright (c) 2015, Threema GmbH |
||
6 | */ |
||
7 | |||
8 | //disallow using the cli tool in a web project |
||
9 | if ('cli' !== php_sapi_name() || null === $argv) { |
||
10 | //file not called from the cli |
||
11 | die('please run ' . basename(__FILE__) . ' only in a cli. '. |
||
12 | 'To use the threema msgapi sdk in your web project, include the source/bootstrap.php or the threema_msgapi.phar file.'); |
||
13 | } |
||
14 | try { |
||
15 | include 'threema_msgapi.phar'; // use phar |
||
16 | // or source: include 'source/bootstrap.php'; |
||
0 ignored issues
–
show
|
|||
17 | |||
18 | $tool = new \Threema\Console\Run( |
||
19 | $argv, |
||
20 | //create a phpfile public keystore |
||
21 | Threema\MsgApi\PublicKeyStores\PhpFile::create('keystore.php')); |
||
22 | $tool->run(); |
||
23 | } catch (\Threema\Core\Exception $exception) { |
||
24 | echo "ERROR: " . $exception->getMessage() . "\n"; |
||
25 | die(); |
||
26 | } |
||
27 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.