GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

TransactionTransformer::transform()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 19
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 17
nc 4
nop 1
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Transformers\Mmex;
4
5
use App\Models\Transaction;
6
use League\Fractal\TransformerAbstract;
7
use Spatie\MediaLibrary\Media;
8
9
class TransactionTransformer extends TransformerAbstract
10
{
11
    /**
12
     * A Fractal transformer.
13
     *
14
     * @param Transaction $item
15
     *
16
     * @return array
17
     */
18
    public function transform(Transaction $item)
19
    {
20
        return [
21
            'ID'          => (string) $item->id,
22
            'Date'        => $item->transaction_date ? $item->transaction_date->toDateString() : null,
23
            'Account'     => $item->account_name,
24
            'ToAccount'   => $item->to_account_name,
25
            'Status'      => $item->status ? $item->status->slug : null,
26
            'Type'        => $item->type->name,
27
            'Payee'       => $item->payee_name,
28
            'Category'    => $item->category_name,
29
            'SubCategory' => $item->sub_category_name,
30
            'Amount'      => (string) floatval($item->amount),
31
            'Notes'       => $item->notes,
32
            'Attachments' => $item->getMedia('attachments')
33
                ->map(function (Media $mediaItem) {
34
                    return $mediaItem->file_name;
35
                })->implode(';'), ];
36
    }
37
}
38