PostFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 6
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\Blog;
6
7
use OpenApi\Annotations as OA;
8
9
/**
10
 * @OA\Schema(
11
 *      schema="Post",
12
 *      @OA\Property(example="100", property="id", format="int"),
13
 *      @OA\Property(example="Title", property="title", format="string"),
14
 *      @OA\Property(example="Text", property="content", format="string"),
15
 * )
16
 */
17
final class PostFormatter
18
{
19 2
    public function format(Post $post): array
20
    {
21
        return [
22 2
            'id' => $post->getId(),
23 2
            'title' => $post->getTitle(),
24 2
            'content' => $post->getContent(),
25
        ];
26
    }
27
}
28