Post::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace App\Entity;
4
5
use \JsonSerializable;
6
7
/**
8
 * @Entity
9
 * @Table(name="posts")
10
 */
11
class Post implements JsonSerializable
12
{
13
14
    /**
15
     * @Id
16
     * @Column(type="integer")
17
     * @GeneratedValue
18
     */
19
    protected $id;
20
21
    /**
22
     * @Column(type="string")
23
     */
24
    protected $title;
25
26
    /**
27
     * @Column(type="text", length=65535)
28
     */
29
    protected $content;
30
31
32
    public function jsonSerialize()
33
    {
34
        return [
35
            'id' => $this->id,
36
            'title' => $this->title,
37
            'content' => $this->content,
38
        ];
39
    }
40
}
41