RoleTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Auth\Transformers\Rolearea\Adminarea;
6
7
use Cortex\Auth\Models\Role;
8
use Rinvex\Support\Traits\Escaper;
9
use League\Fractal\TransformerAbstract;
10
11
class RoleTransformer extends TransformerAbstract
12
{
13
    use Escaper;
14
15
    /**
16
     * @return array
17
     */
18
    public function transform(Role $role): array
19
    {
20
        return $this->escape([
21
            'id' => (string) $role->getRouteKey(),
22
            'title' => (string) $role->title,
23
            'name' => (string) $role->name,
24
            'created_at' => (string) $role->created_at,
25
            'updated_at' => (string) $role->updated_at,
26
        ]);
27
    }
28
}
29