Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
83.33% covered (warning)
83.33%
5 / 6
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Subject
83.33% covered (warning)
83.33%
5 / 6
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
80.00% covered (warning)
80.00%
4 / 5
5.20
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWord
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUsageCount
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 incrementUsageCount
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLastUsedAt
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * @author Wilhelm Zwertvaegher
9 */
10#[ORM\Entity]
11#[ORM\Table(name: 'subject')]
12#[ORM\UniqueConstraint(name: 'uq_subject_word', columns: ['word_id'])]
13class Subject implements GrammaticalRole
14{
15    #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
16    private int $id;
17
18    #[ORM\ManyToOne(targetEntity: Word::class)]
19    #[ORM\JoinColumn(nullable: false)]
20    private Word $word;
21
22    #[ORM\Column(type: 'integer')]
23    private int $usageCount = 0;
24
25    #[ORM\Column(type: 'datetime_immutable', nullable: true)]
26    private ?\DateTimeImmutable $lastUsedAt;
27
28    public function __construct(Word $word)
29    {
30        $this->word = $word;
31    }
32
33    public function getWord(): Word
34    {
35        return $this->word;
36    }
37
38    public function getUsageCount(): int
39    {
40        return $this->usageCount;
41    }
42
43    public function incrementUsageCount(\DateTimeImmutable $usedAt): void
44    {
45        ++$this->usageCount;
46        $this->lastUsedAt = $usedAt;
47    }
48
49    public function getLastUsedAt(): ?\DateTimeImmutable
50    {
51        return $this->lastUsedAt;
52    }
53}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Subject->__construct
28    public function __construct(Word $word)
29    {
30        $this->word = $word;
31    }
Subject->getLastUsedAt
51        return $this->lastUsedAt;
52    }
Subject->getUsageCount
40        return $this->usageCount;
41    }
Subject->getWord
35        return $this->word;
36    }
Subject->incrementUsageCount
43    public function incrementUsageCount(\DateTimeImmutable $usedAt): void
44    {
45        ++$this->usageCount;
46        $this->lastUsedAt = $usedAt;
47    }