FeatureManager: Avoid $this assignment

Just make the callback non-static

Change-Id: I409857dffdbcdd80dfbbe2fb8c64858e9a8f80ef
This commit is contained in:
Umherirrender 2024-01-11 22:36:03 +01:00
parent 8a0961c815
commit 4fcd95bcb4

View file

@ -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 ) );
}