You are here

public function TaxRatePercentage::toString in Commerce Core 8.2

Gets the string representation of the object.

Return value

string The string representation of the object.

File

modules/tax/src/TaxRatePercentage.php, line 65

Class

TaxRatePercentage
Represents a tax rate percentage.

Namespace

Drupal\commerce_tax

Code

public function toString() {
  if ($this->endDate) {
    return t('@number (@start_date - @end_date)', [
      '@number' => $this->number * 100 . '%',
      '@start_date' => $this
        ->getStartDate()
        ->format('M jS Y'),
      '@end_date' => $this
        ->getEndDate()
        ->format('M jS Y'),
    ]);
  }
  else {
    return t('@number (Since @start_date)', [
      '@number' => $this->number * 100 . '%',
      '@start_date' => $this
        ->getStartDate()
        ->format('M jS Y'),
    ]);
  }
}