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 | |||
3 | /** |
||
4 | * load.php |
||
5 | * |
||
6 | * This file performs class loading operations if/when composer is not available. |
||
7 | * Including this file in your project will give you immediate access to the |
||
8 | * functionality of Dcrypt. |
||
9 | * |
||
10 | * PHP version 5 |
||
11 | * |
||
12 | * @category Dcrypt |
||
13 | * @package Dcrypt |
||
14 | * @author Michael Meyer (mmeyer2k) <[email protected]> |
||
15 | * @license http://opensource.org/licenses/MIT The MIT License (MIT) |
||
16 | * @link https://github.com/mmeyer2k/dcrypt |
||
17 | */ |
||
18 | // @codeCoverageIgnoreStart |
||
19 | $g = 'dcrypt_loaded'; |
||
20 | |||
21 | if (!defined($g)) { |
||
22 | define($g, true); |
||
23 | |||
24 | // Files must be in correct order to honor inheritance |
||
25 | $files = array( |
||
26 | 'Str', |
||
27 | 'Support', |
||
28 | 'Cryptobase', |
||
29 | 'Hash', |
||
30 | 'Mcrypt', |
||
31 | 'Aes', |
||
32 | 'AesCtr', |
||
33 | 'Otp', |
||
34 | 'Pkcs7', |
||
35 | 'Random', |
||
36 | 'Rc4', |
||
37 | 'Spritz', |
||
38 | ); |
||
39 | |||
40 | foreach ($files as $f) { |
||
41 | require_once __DIR__ . "/src/$f.php"; |
||
42 | } |
||
43 | } |
||
44 | // @codeCoverageIgnoreEnd |
||
45 |
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.