UserTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 7 1
1
<?php
2
/**
3
 * This file is part of user_management
4
 * User: Sinan TURGUT <[email protected]>
5
 * Date: 24.06.2019
6
 * php version 7.2
7
 *
8
 * @category Assessment
9
 * @package  UserManagement
10
 * @author   Sinan TURGUT <[email protected]>
11
 * @license  See LICENSE file
12
 * @link     https://dev.sinanturgut.com.tr
13
 */
14
15
namespace UserManagement\Transformers;
16
17
use UserManagement\Models\User;
18
use League\Fractal\TransformerAbstract;
0 ignored issues
show
Bug introduced by
The type League\Fractal\TransformerAbstract was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
20
/**
21
 * Class UserTransformer
22
 * @package UserManagement\Transformers
23
 */
24
class UserTransformer extends  TransformerAbstract
25
{
26
    /**
27
     * @param User $user
28
     * @return array
29
     */
30
    public function transform(User $user)
31
    {
32
        return [
33
            'id'        => $user->id,
34
            'username'     => $user->username,
35
            'last_login' => $user->last_login_date,
36
            'is_admin' => $user->isAdmin()
37
        ];
38
    }
39
40
}