mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 23:33:54 +00:00
FeatureManager: Avoid $this assignment
Just make the callback non-static Change-Id: I409857dffdbcdd80dfbbe2fb8c64858e9a8f80ef
This commit is contained in:
parent
8a0961c815
commit
4fcd95bcb4
|
@ -155,15 +155,14 @@ class FeatureManager {
|
|||
* @return array
|
||||
*/
|
||||
public function getFeatureBodyClass() {
|
||||
$featureManager = $this;
|
||||
return array_map( static function ( $featureName ) use ( $featureManager ) {
|
||||
return array_map( function ( $featureName ) {
|
||||
// switch to lower case and switch from camel case to hyphens
|
||||
$featureClass = ltrim( strtolower( preg_replace( '/[A-Z]([A-Z](?![a-z]))*/', '-$0', $featureName ) ), '-' );
|
||||
|
||||
// Client side preferences
|
||||
switch ( $featureClass ) {
|
||||
case 'custom-font-size':
|
||||
$suffixEnabled = 'clientpref-' . $featureManager->getFontValueFromUserPreferenceForSuffix();
|
||||
$suffixEnabled = 'clientpref-' . $this->getFontValueFromUserPreferenceForSuffix();
|
||||
$suffixDisabled = 'clientpref-0';
|
||||
break;
|
||||
case 'limited-width':
|
||||
|
@ -178,7 +177,7 @@ class FeatureManager {
|
|||
break;
|
||||
}
|
||||
$prefix = 'vector-feature-' . $featureClass . '-';
|
||||
return $featureManager->isFeatureEnabled( $featureName ) ?
|
||||
return $this->isFeatureEnabled( $featureName ) ?
|
||||
$prefix . $suffixEnabled : $prefix . $suffixDisabled;
|
||||
}, array_keys( $this->features ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue