Completed
Push — develop ( dbe2eb...04ef1b )
by Abdelrahman
03:40 queued 22s
created

AttributeTransformer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Attributes\Transformers\Adminarea;
6
7
use Cortex\Attributes\Models\Attribute;
8
use League\Fractal\TransformerAbstract;
9
10
class AttributeTransformer extends TransformerAbstract
11
{
12
    /**
13
     * @return array
14
     */
15
    public function transform(Attribute $attribute): array
16
    {
17
        return [
18
            'id' => (string) $attribute->getRouteKey(),
19
            'name' => (string) $attribute->name,
20
            'type' => (string) $attribute->type,
21
            'group' => (string) $attribute->group,
22
            'is_collection' => (bool) $attribute->is_collection,
23
            'is_required' => (bool) $attribute->is_required,
24
            'created_at' => (string) $attribute->created_at,
25
            'updated_at' => (string) $attribute->updated_at,
26
        ];
27
    }
28
}
29