Conditions | 6 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | function validate(string $value, \CharlotteDunois\Livia\Commands\Context $context, ?\CharlotteDunois\Livia\Arguments\Argument $arg = null) { |
||
29 | $value = \filter_var($value, \FILTER_VALIDATE_INT); |
||
30 | if($value === false) { |
||
31 | return false; |
||
32 | } |
||
33 | |||
34 | if($arg->min !== null && $value < $arg->min) { |
||
35 | return 'Please enter a number above or exactly '.$arg->min.'.'; |
||
36 | } |
||
37 | |||
38 | if($arg->max !== null && $value > $arg->max) { |
||
39 | return 'Please enter a number below or exactly '.$arg->max.'.'; |
||
40 | } |
||
41 | |||
42 | return true; |
||
43 | } |
||
53 |