1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/app/Ninja/Transformers/DocumentTransformer.php
Holger Lösken 0fbda85a59 Code Refactoring
- Removed unused uses
- Type hinting for method parameters
- Removed commented code
- Introduced comments for classes and methods
- Short array syntax
2016-07-03 16:19:22 +00:00

26 lines
785 B
PHP

<?php namespace App\Ninja\Transformers;
use App\Models\Document;
/**
* Class DocumentTransformer
*/
class DocumentTransformer extends EntityTransformer
{
/**
* @param Document $document
* @return array
*/
public function transform(Document $document)
{
return array_merge($this->getDefaults($document), [
'id' => (int) $document->public_id,
'name' => $document->name,
'type' => $document->type,
'invoice_id' => isset($document->invoice->public_id) ? (int) $document->invoice->public_id : null,
'expense_id' => isset($document->expense->public_id) ? (int) $document->expense->public_id : null,
'updated_at' => $this->getTimestamp($document->updated_at),
]);
}
}