UserFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 5
c 3
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\User;
6
7
use OpenApi\Annotations as OA;
8
9
/**
10
 * @OA\Schema(
11
 *      schema="User",
12
 *      @OA\Property(example="UserName", property="login", format="string"),
13
 *      @OA\Property(example="13.12.2020 00:04:20", property="created_at", format="string"),
14
 * )
15
 */
16
final class UserFormatter
17
{
18 2
    public function format(User $user): array
19
    {
20
        return [
21 2
            'login' => $user->getLogin(),
22
            'created_at' => $user
23 2
                ->getCreatedAt()
24 2
                ->format('d.m.Y H:i:s'),
25
        ];
26
    }
27
}
28