| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 34 | 6 | public static function newFromGlobals() { |
|
|
|
|||
| 35 | 6 | $GLOBALS['sucgCachePrefix'] = $GLOBALS['wgCachePrefix'] === false ? wfWikiID() : $GLOBALS['wgCachePrefix']; |
|
| 36 | |||
| 37 | $configuration = array( |
||
| 38 | 6 | 'tooltipRequestCacheTTL' => $GLOBALS['sucgTooltipRequestCacheLifetime'], |
|
| 39 | 6 | 'cachePrefix' => $GLOBALS['sucgCachePrefix'], |
|
| 40 | 6 | 'enabledNamespaceWithTemplate' => $GLOBALS['sucgEnabledNamespaceWithTemplate'], |
|
| 41 | 6 | 'enabledForAnonUsers' => $GLOBALS['sucgEnabledForAnonUser'], |
|
| 42 | 6 | 'backendParserCacheLifetime' => $GLOBALS['sucgBackendParserCacheLifetime'], |
|
| 43 | 6 | 'backendParserCacheType' => $GLOBALS['sucgBackendParserCacheType'] |
|
| 44 | 6 | ); |
|
| 45 | |||
| 46 | 6 | return new self( $configuration ); |
|
| 47 | } |
||
| 48 | |||
| 88 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: