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

WorldResource::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 1
dl 0
loc 15
rs 9.9666
c 0
b 0
f 0
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
}