- // Cast everything to strings immediately, so that we know all of the values have the same
- // precision, and can be compared with '==='. 2/24 has a few more decimal places than its
- // default string representation, for example, and would confuse comparisons.
-
- // Misleadingly, the 'days' option supports hours too.
- $days = array_map( 'strval', [ 1 / 24, 2 / 24, 6 / 24, 12 / 24, 1, 3, 7 ] );
-
- $userWatchlistOption = (string)$this->getUser()->getOption( 'watchlistdays' );
- // add the user preference, if it isn't available already
- if ( !in_array( $userWatchlistOption, $days ) && $userWatchlistOption !== '0' ) {
- $days[] = $userWatchlistOption;
- }
-
- $maxDays = (string)$this->maxDays;
- // add the maximum possible value, if it isn't available already
- if ( !in_array( $maxDays, $days ) ) {
- $days[] = $maxDays;
- }
-
- $selected = (string)$options['days'];