Passed
Push — master ( 471523...a46036 )
by Arthur
13:15
created

MachineTransformer::transformResource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 19
nc 1
nop 0
dl 0
loc 21
ccs 19
cts 19
cp 1
crap 1
rs 9.6333
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 29.10.18
6
 * Time: 09:38.
7
 */
8
9
namespace Modules\Machine\Transformers;
10
11
use Foundation\Abstracts\Transformers\Transformer;
12
use Modules\Account\Transformers\AccountTransformer;
13
use Modules\Machine\Entities\Machine;
14
use Modules\User\Transformers\UserTransformer;
15
16
class MachineTransformer extends Transformer
17
{
18
    public $available = [
19
        'user' => UserTransformer::class,
20
        'accounts' => AccountTransformer::class
21
    ];
22
23
    /**
24
     * Transform the resource into an array.
25
     *
26
     * @return array
27
     */
28 11
    public function transformResource()
29
    {
30
        return [
31 11
            'id'               => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
32 11
            'user_id'          => $this->user_id,
0 ignored issues
show
Bug Best Practice introduced by
The property user_id does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
33 11
            'name'             => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
34 11
            'hostname'         => $this->hostname,
0 ignored issues
show
Bug Best Practice introduced by
The property hostname does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
35 11
            'username'         => $this->username,
0 ignored issues
show
Bug Best Practice introduced by
The property username does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
36 11
            'os'               => $this->os,
0 ignored issues
show
Bug Best Practice introduced by
The property os does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
37 11
            'hash'             => $this->hash,
0 ignored issues
show
Bug Best Practice introduced by
The property hash does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
38 11
            'active'           => $this->active,
0 ignored issues
show
Bug Best Practice introduced by
The property active does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
39 11
            'ip_address'       => $this->ip_address,
0 ignored issues
show
Bug Best Practice introduced by
The property ip_address does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
40 11
            'mac_address'      => $this->mac_address,
0 ignored issues
show
Bug Best Practice introduced by
The property mac_address does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
41 11
            'memory_usage'     => $this->memory_usage,
0 ignored issues
show
Bug Best Practice introduced by
The property memory_usage does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
42 11
            'memory_available' => $this->memory_available,
0 ignored issues
show
Bug Best Practice introduced by
The property memory_available does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
43 11
            'cpu_usage'        => $this->cpu_usage,
0 ignored issues
show
Bug Best Practice introduced by
The property cpu_usage does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
44 11
            'cpu_clock'        => $this->cpu_clock,
0 ignored issues
show
Bug Best Practice introduced by
The property cpu_clock does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
45 11
            'online'           => $this->online,
0 ignored issues
show
Bug Best Practice introduced by
The property online does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
46 11
            'last_heartbeat'   => $this->last_heartbeat ?? null,
0 ignored issues
show
Bug Best Practice introduced by
The property last_heartbeat does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
47 11
            'created_at'       => $this->created_at,
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
48 11
            'updated_at'       => $this->updated_at,
0 ignored issues
show
Bug Best Practice introduced by
The property updated_at does not exist on Modules\Machine\Transformers\MachineTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
49
        ];
50
    }
51
}
52