UserResource   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 8 2
1
<?php
2
3
namespace Zefy\LaravelSSO\Resources;
4
5
use Illuminate\Http\Resources\Json\Resource;
6
7
class UserResource extends Resource
8
{
9
    /**
10
     * Transform the resource into an array.
11
     *
12
     * @param  \Illuminate\Http\Request
13
     * @return array
14
     */
15
    public function toArray($request)
16
    {
17
        $fields = [];
18
        foreach (config('laravel-sso.userFields') as $key => $value) {
19
            $fields[$key] = $this->{$value};
20
        }
21
22
        return $fields;
23
    }
24
}
25