Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
88.24% |
15 / 17 |
|
81.82% |
9 / 11 |
|
81.82% |
9 / 11 |
|
81.82% |
9 / 11 |
CRAP | |
0.00% |
0 / 1 |
| Nick | |
88.24% |
15 / 17 |
|
81.82% |
9 / 11 |
|
81.82% |
9 / 11 |
|
81.82% |
9 / 11 |
11.73 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLabel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSubject | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getQualifier | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTargetGender | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOffenseLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| incrementUsageCount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUsageCount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLastUsedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Entity; |
| 4 | |
| 5 | use App\Enum\OffenseLevel; |
| 6 | use App\Enum\WordGender; |
| 7 | use Doctrine\ORM\Mapping as ORM; |
| 8 | |
| 9 | /** |
| 10 | * @author Wilhelm Zwertvaegher |
| 11 | */ |
| 12 | #[ORM\Entity] |
| 13 | #[ORM\Table(name: 'nick')] |
| 14 | #[ORM\UniqueConstraint(name: 'uq_nick_properties', columns: ['subject_id', 'qualifier_id', 'target_gender'])] |
| 15 | class Nick |
| 16 | { |
| 17 | #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')] |
| 18 | private int $id; |
| 19 | |
| 20 | #[ORM\Column(type: 'string', length: 100)] |
| 21 | private string $label; |
| 22 | |
| 23 | #[ORM\ManyToOne(targetEntity: Subject::class)] |
| 24 | #[ORM\JoinColumn(nullable: false)] |
| 25 | private Subject $subject; |
| 26 | |
| 27 | #[ORM\ManyToOne(targetEntity: Qualifier::class)] |
| 28 | #[ORM\JoinColumn(nullable: false)] |
| 29 | private Qualifier $qualifier; |
| 30 | |
| 31 | #[ORM\Column(type: 'string', length: 10, enumType: WordGender::class)] |
| 32 | private WordGender $targetGender; |
| 33 | |
| 34 | #[ORM\Column(type: 'integer', length: 3, enumType: OffenseLevel::class)] |
| 35 | private OffenseLevel $offenseLevel; |
| 36 | |
| 37 | #[ORM\Column(type: 'integer')] |
| 38 | private int $usageCount = 0; |
| 39 | |
| 40 | #[ORM\Column(type: 'datetime_immutable')] |
| 41 | private \DateTimeImmutable $createdAt; |
| 42 | |
| 43 | #[ORM\Column(type: 'datetime_immutable')] |
| 44 | private \DateTimeImmutable $lastUsedAt; |
| 45 | |
| 46 | public function __construct( |
| 47 | string $label, |
| 48 | Subject $subject, |
| 49 | Qualifier $qualifier, |
| 50 | WordGender $targetGender, |
| 51 | OffenseLevel $offenseLevel, |
| 52 | \DateTimeImmutable $createdAt, |
| 53 | \DateTimeImmutable $lastUsedAt, |
| 54 | ) { |
| 55 | $this->label = $label; |
| 56 | $this->subject = $subject; |
| 57 | $this->qualifier = $qualifier; |
| 58 | $this->targetGender = $targetGender; |
| 59 | $this->offenseLevel = $offenseLevel; |
| 60 | $this->createdAt = $createdAt; |
| 61 | $this->lastUsedAt = $lastUsedAt; |
| 62 | } |
| 63 | |
| 64 | public function getId(): int |
| 65 | { |
| 66 | return $this->id; |
| 67 | } |
| 68 | |
| 69 | public function getLabel(): string |
| 70 | { |
| 71 | return $this->label; |
| 72 | } |
| 73 | |
| 74 | public function getSubject(): Subject |
| 75 | { |
| 76 | return $this->subject; |
| 77 | } |
| 78 | |
| 79 | public function getQualifier(): Qualifier |
| 80 | { |
| 81 | return $this->qualifier; |
| 82 | } |
| 83 | |
| 84 | public function getTargetGender(): WordGender |
| 85 | { |
| 86 | return $this->targetGender; |
| 87 | } |
| 88 | |
| 89 | public function getOffenseLevel(): OffenseLevel |
| 90 | { |
| 91 | return $this->offenseLevel; |
| 92 | } |
| 93 | |
| 94 | public function incrementUsageCount(): void |
| 95 | { |
| 96 | ++$this->usageCount; |
| 97 | } |
| 98 | |
| 99 | public function getUsageCount(): int |
| 100 | { |
| 101 | return $this->usageCount; |
| 102 | } |
| 103 | |
| 104 | public function getCreatedAt(): \DateTimeImmutable |
| 105 | { |
| 106 | return $this->createdAt; |
| 107 | } |
| 108 | |
| 109 | public function getLastUsedAt(): \DateTimeImmutable |
| 110 | { |
| 111 | return $this->lastUsedAt; |
| 112 | } |
| 113 | } |