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 | * Entry point of the DataValues Common library. |
||
5 | * |
||
6 | * @since 0.1 |
||
7 | * @codeCoverageIgnore |
||
8 | * |
||
9 | * @licence GNU GPL v2+ |
||
10 | * @author Jeroen De Dauw < [email protected] > |
||
11 | */ |
||
12 | |||
13 | if ( defined( 'DATAVALUES_COMMON_VERSION' ) ) { |
||
14 | // Do not initialize more than once. |
||
15 | return 1; |
||
16 | } |
||
17 | |||
18 | define( 'DATAVALUES_COMMON_VERSION', '0.3.1' ); |
||
19 | |||
20 | if ( defined( 'MEDIAWIKI' ) ) { |
||
21 | $GLOBALS['wgExtensionCredits']['datavalues'][] = array( |
||
22 | 'path' => __DIR__, |
||
23 | 'name' => 'DataValues Common', |
||
24 | 'version' => DATAVALUES_COMMON_VERSION, |
||
25 | 'author' => array( |
||
26 | '[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' |
||
27 | ), |
||
28 | 'url' => 'https://github.com/DataValues/Common', |
||
29 | 'description' => 'Contains common implementations of the interfaces defined by DataValuesInterfaces', |
||
30 | 'license-name' => 'GPL-2.0+' |
||
31 | ); |
||
32 | } |
||
33 |
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.