config = $config; $this->title = $title; $this->request = $request; } /** * @inheritDoc */ public function getName(): string { return Constants::REQUIREMENT_LIMITED_WIDTH_CONTENT; } /** * Per the $options configuration (for use with $wgVectorMaxWidthOptions) * determine whether max-width should be disabled on the page. * For the main page: Check the value of $options['exclude']['mainpage'] * For all other pages, the following will happen: * - the array $options['include'] of canonical page names will be checked * against the current page. If a page has been listed there, function will return false * (max-width will not be disabled) * Max width is disabled if: * 1) The current namespace is listed in array $options['exclude']['namespaces'] * OR * 2) A query string parameter matches one of the regex patterns in $exclusions['querystring']. * * @internal only for use inside tests. * @param array $options * @param Title $title * @param WebRequest $request * @return bool */ private static function shouldDisableMaxWidth( array $options, Title $title, WebRequest $request ): bool { return ConfigHelper::shouldDisable( $options, $request, $title ); } /** * Check query parameter to override config or not. * Then check for AB test value. * Fallback to config value. * * @inheritDoc */ public function isMet(): bool { return $this->title && !self::shouldDisableMaxWidth( $this->config->get( 'VectorMaxWidthOptions' ), $this->title, $this->request ); } }