You are here

public function TaxRate::toArray in Commerce Core 8.2

Gets the array representation of the tax rate.

Return value

array The array representation of the tax rate.

File

modules/tax/src/TaxRate.php, line 102

Class

TaxRate
Represents a tax rate.

Namespace

Drupal\commerce_tax

Code

public function toArray() : array {
  return [
    'id' => $this->id,
    'default' => $this->default,
    'label' => $this->label,
    'percentages' => array_map(function (TaxRatePercentage $percentage) {
      return $percentage
        ->toArray();
    }, $this->percentages),
  ];
}