user = $user; $this->userOptionsLookup = $userOptionsLookup; $this->optionName = $optionName; $this->requirementName = $requirementName; $this->title = $title; } /** * @inheritDoc */ public function getName(): string { return $this->requirementName; } /** * Checks whether the user preference is enabled or not. Returns true if * enabled AND title is not null. * * @internal * * @return bool */ public function isPreferenceEnabled() { $user = $this->user; $userOptionsLookup = $this->userOptionsLookup; $isEnabled = $userOptionsLookup->getBoolOption( $user, $this->optionName ); return $this->title && $isEnabled; } /** * @inheritDoc */ public function isMet(): bool { return $this->isPreferenceEnabled(); } }