Completed
Push — develop ( 0fa276...8cee88 )
by Abdelrahman
03:20
created

TenantTransformer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 20
rs 10

1 Method

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