Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.0932 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 4 | public function __construct(string $param, string $direction) |
|
36 | { |
||
37 | 4 | $direction = strtoupper($direction); |
|
38 | 4 | if (!in_array($direction, [Sort::DIRECTION_ASC, Sort::DIRECTION_DESC], true)) { |
|
39 | throw new InvalidParamException(sprintf('Invalid direction type `%s`. Only %s is allowed', $direction, |
||
40 | implode(',', [Sort::DIRECTION_ASC, Sort::DIRECTION_DESC]))); |
||
41 | } |
||
42 | 4 | $this->param = $param; |
|
43 | 4 | $this->direction = $direction; |
|
44 | 4 | } |
|
46 |