isSubscription() && !in_array($value, $periods, true)) { $fail( sprintf( __('%s must be a valid subscription period. Valid periods are: %s', 'give'), '{value}', implode( ', ', $periods ) ) ); } } /** * @since 3.0.0 * @return SubscriptionPeriod|null */ public function sanitize($value) { if (SubscriptionPeriod::search($value)) { return new SubscriptionPeriod($value); } return null; } /** * @since 3.0.0 */ public function serializeOption() { // TODO: Implement serializeOption() method. } }