1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/Ninja/Transformers/TaxRateTransformer.php

30 lines
1.1 KiB
PHP
Raw Normal View History

2015-12-21 08:36:29 +01:00
<?php namespace App\Ninja\Transformers;
use App\Models\TaxRate;
/**
* @SWG\Definition(definition="TaxRate", @SWG\Xml(name="TaxRate"))
*/
class TaxRateTransformer extends EntityTransformer
{
/**
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
* @SWG\Property(property="name", type="string", example="GST")
2016-01-26 12:47:19 +01:00
* @SWG\Property(property="account_key", type="string", example="asimplestring", readOnly=true)
2015-12-21 08:36:29 +01:00
* @SWG\Property(property="rate", type="float", example=17.5)
* @SWG\Property(property="updated_at", type="date-time", example="2016-01-01 12:10:00")
* @SWG\Property(property="archived_at", type="date-time", example="2016-01-01 12:10:00")
*/
public function transform(TaxRate $taxRate)
{
2016-05-03 22:02:29 +02:00
return array_merge($this->getDefaults($taxRate), [
2015-12-21 08:36:29 +01:00
'id' => (int) $taxRate->public_id,
'name' => $taxRate->name,
'rate' => (float) $taxRate->rate,
2015-12-27 12:08:58 +01:00
'updated_at' => $this->getTimestamp($taxRate->updated_at),
'archived_at' => $this->getTimestamp($taxRate->deleted_at),
2016-05-03 22:02:29 +02:00
]);
2015-12-21 08:36:29 +01:00
}
}