You are here

public function IntervalBase::generateTrialPeriod in Commerce Recurring Framework 8

Generates the trial period.

Parameters

\Drupal\Core\Datetime\DrupalDateTime $start_date: The trial start date/time.

Return value

\Drupal\commerce_recurring\BillingPeriod The trial period.

Overrides BillingScheduleInterface::generateTrialPeriod

File

src/Plugin/Commerce/BillingSchedule/IntervalBase.php, line 150

Class

IntervalBase
Base class for interval-based billing schedules.

Namespace

Drupal\commerce_recurring\Plugin\Commerce\BillingSchedule

Code

public function generateTrialPeriod(DrupalDateTime $start_date) {

  // Trial periods are always rolling (starting from the given start date).
  $interval = new Interval($this->configuration['trial_interval']['number'], $this->configuration['trial_interval']['unit']);
  return new BillingPeriod($start_date, $interval
    ->add($start_date));
}