valid_units ) ) { $class = get_class( $this ); throw new WC_Vipps_Recurring_Invalid_Value_Exception( "$unit is not a valid value for `unit` in $class." ); } $this->unit = $unit; return $this; } public function set_count( int $count ): self { $this->count = $count; return $this; } /** * @throws WC_Vipps_Recurring_Missing_Value_Exception */ public function to_array( bool $check_required = false ): array { if ( $check_required ) { $this->check_required(); } return [ "unit" => $this->unit, "count" => $this->count ]; } }