Completed
Push — master ( 1f44f2...916496 )
by Ron
03:03
created

WorldResource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 15 2
1
<?php
2
3
namespace App\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
class WorldResource extends JsonResource
8
{
9
    public function toArray($request)
10
    {
11
        $data = [
12
            'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
13
            'galaxy_id' => $this->galaxy_id,
0 ignored issues
show
Bug Best Practice introduced by
The property galaxy_id does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
14
            'map_id' => $this->map_id,
0 ignored issues
show
Bug Best Practice introduced by
The property map_id does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
15
            'name' => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
16
            'display_name' => $this->display_name,
0 ignored issues
show
Bug Best Practice introduced by
The property display_name does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
17
        ];
18
19
        if (!empty($this->updated_at)) {
0 ignored issues
show
Bug Best Practice introduced by
The property updated_at does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
            $data['update_at'] = $this->updated_at->format('Y-m-d H:i:s');
21
        }
22
23
        return $data;
24
    }
25
}