Completed
Push — develop ( 98b9f8...731a0c )
by Abdelrahman
02:22
created

ContactTransformer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

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