phpffcms /
ffcms
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | define('env_name', 'Console'); |
||
| 3 | define('type', 'cli'); |
||
| 4 | |||
| 5 | if (PHP_SAPI !== 'cli' || !defined('root')) { |
||
| 6 | die(); |
||
| 7 | } |
||
| 8 | |||
| 9 | require_once (root . '/Loader/Autoload.php'); |
||
| 10 | |||
| 11 | class App extends Ffcms\Console\App {} |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
The type
App has been defined more than once; this definition is ignored, only the first definition in Loader/Admin/index.php (L17-17) is considered.
This check looks for classes that have been defined more than once. If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface. This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP. Loading history...
|
|||
| 12 | |||
| 13 | try { |
||
| 14 | // prepare to run |
||
| 15 | \App::init([ |
||
| 16 | 'Database' => true |
||
| 17 | ]); |
||
| 18 | // display output |
||
| 19 | echo \App::run(); |
||
| 20 | } catch (Exception $e) { |
||
| 21 | echo $e . "\n"; |
||
| 22 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.