Completed
Push — master ( 1302da...3a2ccf )
by Valentyn
03:07
created

MovieTMDB::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Movies\Entity;
5
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
9
10
/**
11
 * @ORM\Embeddable
12
 */
13
class MovieTMDB
14
{
15
    /**
16
     * @Groups({"list", "view"})
17
     * @ORM\Column(type="integer", unique=true)
18
     */
19
    private $id;
20
21
    /**
22
     * @Groups({"list", "view"})
23
     * @ORM\Column(type="decimal", nullable=true)
24
     */
25
    private $voteAverage;
26
27
    /**
28
     * @Groups({"view"})
29
     * @ORM\Column(type="integer", nullable=true)
30
     */
31
    private $voteCount;
32
33 3
    public function __construct(int $tmdbId, ?float $voteAverage, ?int $voteCount)
34
    {
35 3
        $this->id = $tmdbId;
36 3
        $this->voteAverage = $voteAverage;
37 3
        $this->voteCount = $voteCount;
38 3
    }
39
40 7
    public function getId(): int
41
    {
42 7
        return $this->id;
43
    }
44
45 6
    public function getVoteAverage(): ?float
46
    {
47 6
        return (float)$this->voteAverage;
48
    }
49
50 1
    public function getVoteCount(): ?int
51
    {
52 1
        return (int)$this->voteCount;
53
    }
54
}