Score   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 69
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getScore() 0 4 1
A setScore() 0 6 1
A getScoredBy() 0 4 1
A setScoredBy() 0 6 1
A jsonSerialize() 0 7 1
1
<?php
2
3
namespace NekoAPI\Component\Entity;
4
5
/**
6
 * Class Score
7
 *
8
 * @package NekoAPI\Component\Entity
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class Score extends BaseEntity
12
{
13
    /**
14
     * @var float
15
     */
16
    private $score;
17
18
    /**
19
     * @var int
20
     */
21
    private $scoredBy;
22
23 2
    public function __construct(?float $score, ?int $scoredBy)
24
    {
25 2
        $this->score    = $score;
26 2
        $this->scoredBy = $scoredBy;
27 2
    }
28
29
    /**
30
     * @return float
31
     */
32 2
    public function getScore(): ?float
33
    {
34 2
        return $this->score;
35
    }
36
37
    /**
38
     * @param float $score
39
     *
40
     * @return Score
41
     */
42 1
    public function setScore(float $score): Score
43
    {
44 1
        $this->score = $score;
45
46 1
        return $this;
47
    }
48
49
    /**
50
     * @return int
51
     */
52 2
    public function getScoredBy(): ?int
53
    {
54 2
        return $this->scoredBy;
55
    }
56
57
    /**
58
     * @param int $scoredBy
59
     *
60
     * @return Score
61
     */
62 1
    public function setScoredBy(int $scoredBy): Score
63
    {
64 1
        $this->scoredBy = $scoredBy;
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * @inheritDoc
71
     */
72 1
    public function jsonSerialize(): array
73
    {
74
        return [
75 1
            'score'     => $this->getScore(),
76 1
            'scored_by' => $this->getScoredBy(),
77
        ];
78
    }
79
}