Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
87.50% |
7 / 8 |
|
90.91% |
10 / 11 |
|
80.00% |
8 / 10 |
|
85.71% |
6 / 7 |
CRAP | |
0.00% |
0 / 1 |
| GetWordCommand | |
87.50% |
7 / 8 |
|
90.91% |
10 / 11 |
|
80.00% |
8 / 10 |
|
85.71% |
6 / 7 |
9.65 | |
0.00% |
0 / 1 |
| __construct | |
50.00% |
1 / 2 |
|
80.00% |
4 / 5 |
|
50.00% |
2 / 4 |
|
0.00% |
0 / 1 |
4.12 | |||
| getRole | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getGender | |
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 | |||
| getPreviousId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPrevious | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getExclusions | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Dto\Command; |
| 4 | |
| 5 | use App\Entity\GrammaticalRole; |
| 6 | use App\Enum\GrammaticalRoleType; |
| 7 | use App\Enum\OffenseLevel; |
| 8 | use App\Enum\WordGender; |
| 9 | |
| 10 | /** |
| 11 | * @author Wilhelm Zwertvaegher |
| 12 | */ |
| 13 | readonly class GetWordCommand |
| 14 | { |
| 15 | /** |
| 16 | * @param list<int> $exclusions |
| 17 | */ |
| 18 | public function __construct( |
| 19 | private GrammaticalRoleType $role, |
| 20 | private WordGender $gender, |
| 21 | private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM, |
| 22 | private ?int $previousId = null, |
| 23 | private ?GrammaticalRole $previous = null, |
| 24 | private array $exclusions = [], |
| 25 | ) { |
| 26 | if (null === $previous && null === $this->previousId) { |
| 27 | throw new \InvalidArgumentException('Cannot get a word without a previous word or id'); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | public function getRole(): GrammaticalRoleType |
| 32 | { |
| 33 | return $this->role; |
| 34 | } |
| 35 | |
| 36 | public function getGender(): WordGender |
| 37 | { |
| 38 | return $this->gender; |
| 39 | } |
| 40 | |
| 41 | public function getOffenseLevel(): OffenseLevel |
| 42 | { |
| 43 | return $this->offenseLevel; |
| 44 | } |
| 45 | |
| 46 | public function getPreviousId(): ?int |
| 47 | { |
| 48 | return $this->previousId; |
| 49 | } |
| 50 | |
| 51 | public function getPrevious(): ?GrammaticalRole |
| 52 | { |
| 53 | return $this->previous; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @return list<int> |
| 58 | */ |
| 59 | public function getExclusions(): array |
| 60 | { |
| 61 | return $this->exclusions; |
| 62 | } |
| 63 | } |
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.
| 18 | public function __construct( |
| 19 | private GrammaticalRoleType $role, |
| 20 | private WordGender $gender, |
| 21 | private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM, |
| 22 | private ?int $previousId = null, |
| 23 | private ?GrammaticalRole $previous = null, |
| 24 | private array $exclusions = [], |
| 25 | ) { |
| 26 | if (null === $previous && null === $this->previousId) { |
| 26 | if (null === $previous && null === $this->previousId) { |
| 26 | if (null === $previous && null === $this->previousId) { |
| 27 | throw new \InvalidArgumentException('Cannot get a word without a previous word or id'); |
| 29 | } |
| 61 | return $this->exclusions; |
| 62 | } |
| 38 | return $this->gender; |
| 39 | } |
| 43 | return $this->offenseLevel; |
| 44 | } |
| 53 | return $this->previous; |
| 54 | } |
| 48 | return $this->previousId; |
| 49 | } |
| 33 | return $this->role; |
| 34 | } |
| 3 | namespace App\Dto\Command; |
| 4 | |
| 5 | use App\Entity\GrammaticalRole; |
| 6 | use App\Enum\GrammaticalRoleType; |
| 7 | use App\Enum\OffenseLevel; |
| 8 | use App\Enum\WordGender; |
| 9 | |
| 10 | /** |
| 11 | * @author Wilhelm Zwertvaegher |
| 12 | */ |
| 13 | readonly class GetWordCommand |
| 14 | { |
| 15 | /** |
| 16 | * @param list<int> $exclusions |
| 17 | */ |
| 18 | public function __construct( |
| 19 | private GrammaticalRoleType $role, |
| 20 | private WordGender $gender, |
| 21 | private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM, |
| 22 | private ?int $previousId = null, |
| 23 | private ?GrammaticalRole $previous = null, |
| 24 | private array $exclusions = [], |
| 25 | ) { |
| 26 | if (null === $previous && null === $this->previousId) { |
| 27 | throw new \InvalidArgumentException('Cannot get a word without a previous word or id'); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | public function getRole(): GrammaticalRoleType |
| 32 | { |
| 33 | return $this->role; |
| 34 | } |
| 35 | |
| 36 | public function getGender(): WordGender |
| 37 | { |
| 38 | return $this->gender; |
| 39 | } |
| 40 | |
| 41 | public function getOffenseLevel(): OffenseLevel |
| 42 | { |
| 43 | return $this->offenseLevel; |
| 44 | } |
| 45 | |
| 46 | public function getPreviousId(): ?int |
| 47 | { |
| 48 | return $this->previousId; |
| 49 | } |
| 50 | |
| 51 | public function getPrevious(): ?GrammaticalRole |
| 52 | { |
| 53 | return $this->previous; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @return list<int> |
| 58 | */ |
| 59 | public function getExclusions(): array |
| 60 | { |
| 61 | return $this->exclusions; |
| 62 | } |