Completed
Push — master ( 97cb5e...1302da )
by Valentyn
02:35
created

MovieTMDB   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 2
cbo 0
dl 0
loc 42
ccs 9
cts 11
cp 0.8182
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A getVoteAverage() 0 4 1
A getVoteCount() 0 4 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
 * @UniqueEntity("id")
13
 */
14
class MovieTMDB
15
{
16
    /**
17
     * @Groups({"list", "view"})
18
     * @ORM\Column(type="integer", unique=true)
19
     */
20
    private $id;
21
22
    /**
23
     * @Groups({"list", "view"})
24
     * @ORM\Column(type="decimal", nullable=true)
25
     */
26
    private $voteAverage;
27
28
    /**
29
     * @Groups({"view"})
30
     * @ORM\Column(type="integer", nullable=true)
31
     */
32
    private $voteCount;
33
34 3
    public function __construct(int $tmdbId, ?float $voteAverage, ?int $voteCount)
35
    {
36 3
        $this->id = $tmdbId;
37 3
        $this->voteAverage = $voteAverage;
38 3
        $this->voteCount = $voteCount;
39 3
    }
40
41 6
    public function getId(): int
42
    {
43 6
        return $this->id;
44
    }
45
46 5
    public function getVoteAverage(): ?float
47
    {
48 5
        return (float)$this->voteAverage;
49
    }
50
51
    public function getVoteCount(): ?int
52
    {
53
        return (int)$this->voteCount;
54
    }
55
}