- The following values will pass:
-
- validate_integer(1)
- validate_integer(1, 2)
- validate_integer(1, 1)
- validate_integer(1, 2, 0)
- validate_integer(2, 2, 2)
- validate_integer(2, '', 0)
- validate_integer(2, undef, 0)
- $foo = undef
- validate_integer(2, $foo, 0)
- validate_integer([1,2,3,4,5], 6)
- validate_integer([1,2,3,4,5], 6, 0)
-
- Plus all of the above, but any combination of values passed as strings ('1' or "1").
- Plus all of the above, but with (correct) combinations of negative integer values.
-
- The following values will not:
-
- validate_integer(true)
- validate_integer(false)
- validate_integer(7.0)
- validate_integer({ 1 => 2 })
- $foo = undef
- validate_integer($foo)
- validate_integer($foobaridontexist)
-
- validate_integer(1, 0)
- validate_integer(1, true)
- validate_integer(1, '')
- validate_integer(1, undef)
- validate_integer(1, , 0)
- validate_integer(1, 2, 3)
- validate_integer(1, 3, 2)
- validate_integer(1, 3, true)
-
- Plus all of the above, but any combination of values passed as strings ('false' or "false").
- Plus all of the above, but with incorrect combinations of negative integer values.
- Plus all of the above, but with non-integer items in arrays or maximum / minimum argument.
+ @return
+ Validate that the first argument is an integer (or an array of integers). Fail compilation if any of the checks fail.
+
+ @example **Usage**
+
+ The following values will pass:
+
+ validate_integer(1)
+ validate_integer(1, 2)
+ validate_integer(1, 1)
+ validate_integer(1, 2, 0)
+ validate_integer(2, 2, 2)
+ validate_integer(2, '', 0)
+ validate_integer(2, undef, 0)
+ $foo = undef
+ validate_integer(2, $foo, 0)
+ validate_integer([1,2,3,4,5], 6)
+ validate_integer([1,2,3,4,5], 6, 0)
+
+ Plus all of the above, but any combination of values passed as strings ('1' or "1").
+ Plus all of the above, but with (correct) combinations of negative integer values.
+
+ The following values will not:
+
+ validate_integer(true)
+ validate_integer(false)
+ validate_integer(7.0)
+ validate_integer({ 1 => 2 })
+ $foo = undef
+ validate_integer($foo)
+ validate_integer($foobaridontexist)
+
+ validate_integer(1, 0)
+ validate_integer(1, true)
+ validate_integer(1, '')
+ validate_integer(1, undef)
+ validate_integer(1, , 0)
+ validate_integer(1, 2, 3)
+ validate_integer(1, 3, 2)
+ validate_integer(1, 3, true)
+
+ Plus all of the above, but any combination of values passed as strings ('false' or "false").
+ Plus all of the above, but with incorrect combinations of negative integer values.
+ Plus all of the above, but with non-integer items in arrays or maximum / minimum argument.