AttributeResource   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 7
c 1
b 0
f 0
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 8 1
1
<?php
2
3
namespace Ronmrcdo\Inventory\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
class AttributeResource extends JsonResource
8
{
9
	public function toArray($request)
10
	{
11
		return [
12
			'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Ronmrcdo\Inventory\Resources\AttributeResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
13
			'name' => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Ronmrcdo\Inventory\Resources\AttributeResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
14
			'options' => collect($this->values)->map(function ($item) {
0 ignored issues
show
Bug Best Practice introduced by
The property values does not exist on Ronmrcdo\Inventory\Resources\AttributeResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
15
				return $item->value;
16
			})->values()->toArray()
17
		];
18
	}
19
}