WorldResource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 22 4
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
            '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...
14
            '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...
15
            'year' => $this->year,
0 ignored issues
show
Bug Best Practice introduced by
The property year does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
16
        ];
17
18
        if ($this->investors_count !== null) {
0 ignored issues
show
Bug Best Practice introduced by
The property investors_count does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
19
            $data['investors'] = $this->investors_count;
20
        }
21
22
        if ($this->online_count !== null) {
0 ignored issues
show
Bug Best Practice introduced by
The property online_count does not exist on App\Http\Resources\WorldResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
            $data['online'] = $this->online_count;
24
        }
25
26
        if ($this->updated_at !== null) {
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...
27
            $data['updated_at'] = $this->updated_at->format('Y-m-d H:i:s');
28
        }
29
30
        return $data;
31
    }
32
}