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 |
| RandomNickRequest | |
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 | |||
| getLang | |
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 | |||
| getPreviousNickId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getReplaceRoleType | |
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\Request; |
| 4 | |
| 5 | use App\Enum\GrammaticalRoleType; |
| 6 | use App\Enum\Lang; |
| 7 | use App\Enum\OffenseLevel; |
| 8 | use App\Enum\WordGender; |
| 9 | |
| 10 | /** |
| 11 | * @author Wilhelm Zwertvaegher |
| 12 | * Parameters for random word / nick retrieval |
| 13 | * - Lang |
| 14 | * - OffenseLevel (maybe null) |
| 15 | * - WordGender (maybe null) |
| 16 | * - exclusions : a list a word ids to exclude |
| 17 | */ |
| 18 | readonly class RandomNickRequest implements Request |
| 19 | { |
| 20 | /** |
| 21 | * @param list<int> $exclusions |
| 22 | */ |
| 23 | public function __construct( |
| 24 | private Lang $lang = Lang::FR, |
| 25 | private WordGender $gender = WordGender::AUTO, |
| 26 | private ?OffenseLevel $offenseLevel = null, |
| 27 | private ?int $previousId = null, |
| 28 | private ?GrammaticalRoleType $replaceRole = null, |
| 29 | private array $exclusions = [], |
| 30 | ) { |
| 31 | if (null !== $this->replaceRole && null === $this->previousId) { |
| 32 | throw new \InvalidArgumentException('Unable to replace a word on an unknown nick'); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | public function getLang(): Lang |
| 37 | { |
| 38 | return $this->lang; |
| 39 | } |
| 40 | |
| 41 | public function getGender(): WordGender |
| 42 | { |
| 43 | return $this->gender; |
| 44 | } |
| 45 | |
| 46 | public function getOffenseLevel(): ?OffenseLevel |
| 47 | { |
| 48 | return $this->offenseLevel; |
| 49 | } |
| 50 | |
| 51 | public function getPreviousNickId(): ?int |
| 52 | { |
| 53 | return $this->previousId; |
| 54 | } |
| 55 | |
| 56 | public function getReplaceRoleType(): ?GrammaticalRoleType |
| 57 | { |
| 58 | return $this->replaceRole; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return list<int> |
| 63 | */ |
| 64 | public function getExclusions(): array |
| 65 | { |
| 66 | return $this->exclusions; |
| 67 | } |
| 68 | } |
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.
| 23 | public function __construct( |
| 24 | private Lang $lang = Lang::FR, |
| 25 | private WordGender $gender = WordGender::AUTO, |
| 26 | private ?OffenseLevel $offenseLevel = null, |
| 27 | private ?int $previousId = null, |
| 28 | private ?GrammaticalRoleType $replaceRole = null, |
| 29 | private array $exclusions = [], |
| 30 | ) { |
| 31 | if (null !== $this->replaceRole && null === $this->previousId) { |
| 31 | if (null !== $this->replaceRole && null === $this->previousId) { |
| 31 | if (null !== $this->replaceRole && null === $this->previousId) { |
| 32 | throw new \InvalidArgumentException('Unable to replace a word on an unknown nick'); |
| 34 | } |
| 66 | return $this->exclusions; |
| 67 | } |
| 43 | return $this->gender; |
| 44 | } |
| 38 | return $this->lang; |
| 39 | } |
| 48 | return $this->offenseLevel; |
| 49 | } |
| 53 | return $this->previousId; |
| 54 | } |
| 58 | return $this->replaceRole; |
| 59 | } |
| 3 | namespace App\Dto\Request; |
| 4 | |
| 5 | use App\Enum\GrammaticalRoleType; |
| 6 | use App\Enum\Lang; |
| 7 | use App\Enum\OffenseLevel; |
| 8 | use App\Enum\WordGender; |
| 9 | |
| 10 | /** |
| 11 | * @author Wilhelm Zwertvaegher |
| 12 | * Parameters for random word / nick retrieval |
| 13 | * - Lang |
| 14 | * - OffenseLevel (maybe null) |
| 15 | * - WordGender (maybe null) |
| 16 | * - exclusions : a list a word ids to exclude |
| 17 | */ |
| 18 | readonly class RandomNickRequest implements Request |
| 19 | { |
| 20 | /** |
| 21 | * @param list<int> $exclusions |
| 22 | */ |
| 23 | public function __construct( |
| 24 | private Lang $lang = Lang::FR, |
| 25 | private WordGender $gender = WordGender::AUTO, |
| 26 | private ?OffenseLevel $offenseLevel = null, |
| 27 | private ?int $previousId = null, |
| 28 | private ?GrammaticalRoleType $replaceRole = null, |
| 29 | private array $exclusions = [], |
| 30 | ) { |
| 31 | if (null !== $this->replaceRole && null === $this->previousId) { |
| 32 | throw new \InvalidArgumentException('Unable to replace a word on an unknown nick'); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | public function getLang(): Lang |
| 37 | { |
| 38 | return $this->lang; |
| 39 | } |
| 40 | |
| 41 | public function getGender(): WordGender |
| 42 | { |
| 43 | return $this->gender; |
| 44 | } |
| 45 | |
| 46 | public function getOffenseLevel(): ?OffenseLevel |
| 47 | { |
| 48 | return $this->offenseLevel; |
| 49 | } |
| 50 | |
| 51 | public function getPreviousNickId(): ?int |
| 52 | { |
| 53 | return $this->previousId; |
| 54 | } |
| 55 | |
| 56 | public function getReplaceRoleType(): ?GrammaticalRoleType |
| 57 | { |
| 58 | return $this->replaceRole; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return list<int> |
| 63 | */ |
| 64 | public function getExclusions(): array |
| 65 | { |
| 66 | return $this->exclusions; |
| 67 | } |