1 | <?php |
||
11 | trait FilterValidation |
||
12 | { |
||
13 | /** |
||
14 | * Check if input is integer and stay |
||
15 | * in range between $min and $max. |
||
16 | * |
||
17 | * @param mixed $input Input field |
||
18 | * @param int $min Min range of input |
||
19 | * @param int|string $max Max range of input |
||
20 | * |
||
21 | * @return bool |
||
22 | */ |
||
23 | public function isIntAndBetween($input, $min, $max = "") |
||
39 | |||
40 | /** |
||
41 | * Check if key or value is not of any described types. |
||
42 | * |
||
43 | * @param string $key Value of key |
||
44 | * @param string|array $keyParams Not-Types of key |
||
45 | * @param string $value Value of value |
||
46 | * @param string|array $valueParams Not-Types of value |
||
47 | * |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function isKeyAndValueAre($key, $keyParams, $value, $valueParams) |
||
62 | |||
63 | /** |
||
64 | * Check if values is any of these types. |
||
65 | * |
||
66 | * @param string $param Value |
||
67 | * @param string|array $types Type or array of types |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function isParamOfType($param, $types) |
||
79 | |||
80 | /** |
||
81 | * Check if value is any of these types. |
||
82 | * |
||
83 | * @param string $param Value to check |
||
84 | * @param array $types List of types |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | public function isParamOfTypeMultiple($param, $types) |
||
100 | |||
101 | /** |
||
102 | * Check if value is not that type. |
||
103 | * |
||
104 | * @param string $param Value |
||
105 | * @param string $type Type |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | public function isParamOfTypeSingle($param, $type) |
||
113 | } |