Passed
Push — master ( 5573bb...437f03 )
by Sébastien
03:09
created

AccessLog::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Entity;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * @ORM\Entity
11
 * @ORM\Table(name="access_log")
12
 */
13
class AccessLog implements \JsonSerializable
14
{
15
    /**
16
     * @ORM\Id
17
     * @ORM\Column(name="id", type="integer")
18
     * @ORM\GeneratedValue(strategy="IDENTITY")
19
     *
20
     * @var int
21
     */
22
    private $id;
23
24
    /**
25
     * @ORM\Column(name="name", type="string", length=32)
26
     */
27
    private $name;
28
29
    public function __construct(string $name)
30
    {
31
        $this->name = $name;
32
    }
33
34
    public function jsonSerialize()
35
    {
36
        return [
37
            'id'   => $this->id,
38
            'name' => $this->name
39
        ];
40
    }
41
}
42