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