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 | if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
||
4 | require_once __DIR__ . '/vendor/autoload.php'; |
||
5 | } |
||
6 | |||
7 | call_user_func( function () { |
||
8 | // Set credits |
||
9 | $GLOBALS['wgExtensionCredits']['specialpage'][] = array( |
||
10 | 'path' => __FILE__, |
||
11 | 'name' => 'WikibaseQualityExternalValidation', |
||
12 | 'author' => 'BP2014N1', |
||
13 | 'url' => 'https://www.mediawiki.org/wiki/Extension:WikibaseQualityExternalValidation', |
||
14 | 'descriptionmsg' => 'wbqev-desc', |
||
15 | 'version' => '1.0.0', |
||
16 | 'license-name' => 'GPL-2.0+' |
||
17 | ); |
||
18 | |||
19 | // Initialize localization and aliases |
||
20 | $GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__ . '/i18n'; |
||
21 | $GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] = __DIR__ . '/WikibaseQualityExternalValidation.alias.php'; |
||
22 | |||
23 | // Initalize hooks for creating database tables |
||
24 | $GLOBALS['wgHooks']['LoadExtensionSchemaUpdates'][] = 'WikibaseQualityExternalValidationHooks::onCreateSchema'; |
||
25 | |||
26 | // Register hooks for Unit Tests |
||
27 | $GLOBALS['wgHooks']['UnitTestsList'][] = 'WikibaseQualityExternalValidationHooks::onUnitTestsList'; |
||
28 | |||
29 | // Initialize special pages |
||
30 | $GLOBALS['wgSpecialPages']['CrossCheck'] = 'WikibaseQuality\ExternalValidation\Specials\SpecialCrossCheck::newFromGlobalState'; |
||
31 | $GLOBALS['wgSpecialPages']['ExternalDatabases'] = 'WikibaseQuality\ExternalValidation\Specials\SpecialExternalDatabases::newFromGlobalState'; |
||
32 | |||
33 | // Define API modules |
||
34 | $GLOBALS['wgAPIModules']['wbqevcrosscheck'] = array( |
||
35 | 'class' => 'WikibaseQuality\ExternalValidation\Api\RunCrossCheck', |
||
36 | 'factory' => function( ApiMain $main, $action ) { |
||
37 | return \WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState( $main, $action ); |
||
38 | } |
||
39 | ); |
||
40 | |||
41 | // Define modules |
||
42 | $GLOBALS['wgResourceModules']['SpecialCrossCheckPage'] = array( |
||
43 | 'styles' => '/modules/ext.WikibaseExternalValidation.SpecialCrossCheckPage.css', |
||
44 | 'localBasePath' => __DIR__, |
||
45 | 'remoteExtPath' => 'WikibaseQualityExternalValidation' |
||
46 | ); |
||
47 | |||
48 | // Ids of certain Wikidata entities |
||
49 | if( !defined( 'INSTANCE_OF_PID' ) ) { |
||
50 | define( 'INSTANCE_OF_PID', 'P31' ); |
||
51 | } |
||
52 | if( !defined( 'IDENTIFIER_PROPERTY_QID' ) ) { |
||
53 | define( 'IDENTIFIER_PROPERTY_QID', 'Q19847637' ); |
||
54 | } |
||
55 | if( !defined( 'STATED_IN_PID' ) ) { |
||
56 | define( 'STATED_IN_PID', 'P248' ); |
||
57 | } |
||
58 | } ); |
||
59 |
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.