Completed
Push — develop ( e8c6bf...b28c51 )
by Abdelrahman
02:53
created

AdminTransformer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 19 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Auth\Transformers\Adminarea;
6
7
use Cortex\Auth\Models\Admin;
8
use League\Fractal\TransformerAbstract;
9
10
class AdminTransformer extends TransformerAbstract
11
{
12
    /**
13
     * @return array
14
     */
15
    public function transform(Admin $admin): array
16
    {
17
        return [
18
            'id' => (string) $admin->getRouteKey(),
19
            'is_active' => (bool) $admin->is_active,
20
            'full_name' => (string) $admin->full_name,
21
            'username' => (string) $admin->username,
22
            'email' => (string) $admin->email,
23
            'phone' => (string) $admin->phone,
24
            'country_code' => (string) $admin->country_code ? country($admin->country_code)->getName() : null,
25
            'language_code' => (string) $admin->language_code ? language($admin->language_code)->getName() : null,
26
            'title' => (string) $admin->title,
27
            'birthday' => (string) $admin->birthday,
28
            'gender' => (string) $admin->gender,
29
            'last_activity' => (string) $admin->last_activity,
30
            'created_at' => (string) $admin->created_at,
31
            'updated_at' => (string) $admin->updated_at,
32
        ];
33
    }
34
}
35