Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
90.00% |
9 / 10 |
|
85.71% |
6 / 7 |
|
85.71% |
6 / 7 |
|
85.71% |
6 / 7 |
CRAP | |
0.00% |
0 / 1 |
| Qualifier | |
90.00% |
9 / 10 |
|
85.71% |
6 / 7 |
|
85.71% |
6 / 7 |
|
85.71% |
6 / 7 |
7.14 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getWord | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPosition | |
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 | |||
| setPosition | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| incrementUsageCount | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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\QualifierPosition; |
| 6 | use Doctrine\ORM\Mapping as ORM; |
| 7 | |
| 8 | /** |
| 9 | * @author Wilhelm Zwertvaegher |
| 10 | */ |
| 11 | #[ORM\Entity] |
| 12 | #[ORM\Table(name: 'qualifier')] |
| 13 | #[ORM\UniqueConstraint(name: 'uq_qualifier_word', columns: ['word_id'])] |
| 14 | class Qualifier implements GrammaticalRole |
| 15 | { |
| 16 | #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')] |
| 17 | private int $id; |
| 18 | |
| 19 | #[ORM\ManyToOne(targetEntity: Word::class)] |
| 20 | #[ORM\JoinColumn(nullable: false)] |
| 21 | private Word $word; |
| 22 | |
| 23 | #[ORM\Column(type: 'string', enumType: QualifierPosition::class)] |
| 24 | private QualifierPosition $position; |
| 25 | |
| 26 | #[ORM\Column(type: 'integer')] |
| 27 | private int $usageCount = 0; |
| 28 | |
| 29 | #[ORM\Column(type: 'datetime_immutable', nullable: true)] |
| 30 | private ?\DateTimeImmutable $lastUsedAt; |
| 31 | |
| 32 | public function __construct(Word $word, QualifierPosition $position) |
| 33 | { |
| 34 | $this->word = $word; |
| 35 | $this->position = $position; |
| 36 | } |
| 37 | |
| 38 | public function getWord(): Word |
| 39 | { |
| 40 | return $this->word; |
| 41 | } |
| 42 | |
| 43 | public function getPosition(): QualifierPosition |
| 44 | { |
| 45 | return $this->position; |
| 46 | } |
| 47 | |
| 48 | public function getUsageCount(): int |
| 49 | { |
| 50 | return $this->usageCount; |
| 51 | } |
| 52 | |
| 53 | public function setPosition(QualifierPosition $position): Qualifier |
| 54 | { |
| 55 | $this->position = $position; |
| 56 | |
| 57 | return $this; |
| 58 | } |
| 59 | |
| 60 | public function incrementUsageCount(\DateTimeImmutable $usedAt): void |
| 61 | { |
| 62 | ++$this->usageCount; |
| 63 | $this->lastUsedAt = $usedAt; |
| 64 | } |
| 65 | |
| 66 | public function getLastUsedAt(): ?\DateTimeImmutable |
| 67 | { |
| 68 | return $this->lastUsedAt; |
| 69 | } |
| 70 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 32 | public function __construct(Word $word, QualifierPosition $position) |
| 33 | { |
| 34 | $this->word = $word; |
| 35 | $this->position = $position; |
| 36 | } |
| 68 | return $this->lastUsedAt; |
| 69 | } |
| 45 | return $this->position; |
| 46 | } |
| 50 | return $this->usageCount; |
| 51 | } |
| 40 | return $this->word; |
| 41 | } |
| 60 | public function incrementUsageCount(\DateTimeImmutable $usedAt): void |
| 61 | { |
| 62 | ++$this->usageCount; |
| 63 | $this->lastUsedAt = $usedAt; |
| 64 | } |
| 53 | public function setPosition(QualifierPosition $position): Qualifier |
| 54 | { |
| 55 | $this->position = $position; |
| 56 | |
| 57 | return $this; |
| 58 | } |