Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
RandomWordRequest
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 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
 getPreviousId
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
 getGrammaticalRoleType
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
 getGender
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
 getOffenseLevel
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
 getExclusions
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
1<?php
2
3namespace App\Dto\Request;
4
5use App\Enum\GrammaticalRoleType;
6use App\Enum\OffenseLevel;
7use App\Enum\WordGender;
8use App\Exception\ValidationErrorMessage;
9use Symfony\Component\Validator\Constraints as Assert;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 * Parameters for word retrieval (i.e. replace a word in a generated nick)
14 *  - Lang
15 *  - WordType
16 *  - OffenseLevel (maybe null)
17 *  - WordGender (maybe null)
18 *  - exclusions : a list a word ids to exclude
19 */
20class RandomWordRequest implements Request
21{
22    /**
23     * @param list<int> $exclusions
24     */
25    public function __construct(
26        #[Assert\Type('integer', message: ValidationErrorMessage::INVALID_FIELD_VALUE)]
27        private int $previousId,
28        private GrammaticalRoleType $role,
29        private WordGender $gender,
30        private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM,
31        private array $exclusions = [],
32    ) {
33    }
34
35    public function getPreviousId(): int
36    {
37        return $this->previousId;
38    }
39
40    public function getGrammaticalRoleType(): GrammaticalRoleType
41    {
42        return $this->role;
43    }
44
45    public function getGender(): ?WordGender
46    {
47        return $this->gender;
48    }
49
50    public function getOffenseLevel(): ?OffenseLevel
51    {
52        return $this->offenseLevel;
53    }
54
55    /**
56     * @return list<int>
57     */
58    public function getExclusions(): array
59    {
60        return $this->exclusions;
61    }
62}

Branches

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.

RandomWordRequest->__construct
25    public function __construct(
26        #[Assert\Type('integer', message: ValidationErrorMessage::INVALID_FIELD_VALUE)]
27        private int $previousId,
28        private GrammaticalRoleType $role,
29        private WordGender $gender,
30        private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM,
31        private array $exclusions = [],
32    ) {
33    }
RandomWordRequest->getExclusions
60        return $this->exclusions;
61    }
RandomWordRequest->getGender
47        return $this->gender;
48    }
RandomWordRequest->getGrammaticalRoleType
42        return $this->role;
43    }
RandomWordRequest->getOffenseLevel
52        return $this->offenseLevel;
53    }
RandomWordRequest->getPreviousId
37        return $this->previousId;
38    }
{main}
3namespace App\Dto\Request;
4
5use App\Enum\GrammaticalRoleType;
6use App\Enum\OffenseLevel;
7use App\Enum\WordGender;
8use App\Exception\ValidationErrorMessage;
9use Symfony\Component\Validator\Constraints as Assert;
10
11/**
12 * @author Wilhelm Zwertvaegher
13 * Parameters for word retrieval (i.e. replace a word in a generated nick)
14 *  - Lang
15 *  - WordType
16 *  - OffenseLevel (maybe null)
17 *  - WordGender (maybe null)
18 *  - exclusions : a list a word ids to exclude
19 */
20class RandomWordRequest implements Request
21{
22    /**
23     * @param list<int> $exclusions
24     */
25    public function __construct(
26        #[Assert\Type('integer', message: ValidationErrorMessage::INVALID_FIELD_VALUE)]
27        private int $previousId,
28        private GrammaticalRoleType $role,
29        private WordGender $gender,
30        private OffenseLevel $offenseLevel = OffenseLevel::MEDIUM,
31        private array $exclusions = [],
32    ) {
33    }
34
35    public function getPreviousId(): int
36    {
37        return $this->previousId;
38    }
39
40    public function getGrammaticalRoleType(): GrammaticalRoleType
41    {
42        return $this->role;
43    }
44
45    public function getGender(): ?WordGender
46    {
47        return $this->gender;
48    }
49
50    public function getOffenseLevel(): ?OffenseLevel
51    {
52        return $this->offenseLevel;
53    }
54
55    /**
56     * @return list<int>
57     */
58    public function getExclusions(): array
59    {
60        return $this->exclusions;
61    }