1 | <?php |
||
5 | class Modifier { |
||
6 | /** |
||
7 | * Set value to null if value is empty |
||
8 | * @param mixed $variable This should be the variable you are checking if it is empty |
||
9 | * @return mixed Returns either NULL or the original variable |
||
10 | */ |
||
11 | public static function setNullOnEmpty($variable) { |
||
17 | |||
18 | /** |
||
19 | * Set value to 0 if value is empty |
||
20 | * @param mixed $variable This should be the variable you are checking if it is empty |
||
21 | * @return mixed Returns either 0 or the original variable |
||
22 | */ |
||
23 | public static function setZeroOnEmpty($variable) { |
||
29 | |||
30 | /** |
||
31 | * Checks to see if required filed have been filled in and are not empty |
||
32 | * @param mixed $variable This should be the variable you are checking |
||
33 | * @return boolean Will return true if not empty and contains at least minimum number of characters else returns false |
||
34 | */ |
||
35 | public static function isRequiredString($variable, $minStringLength = 2) { |
||
41 | |||
42 | /** |
||
43 | * Checks to see if the variable is numeric or not |
||
44 | * @param mixed $variable This should be the variable you are testing if it is a number or not |
||
45 | * @return boolean Returns true if numeric else returns false |
||
46 | */ |
||
47 | public static function isRequiredNumeric($variable) { |
||
53 | |||
54 | /** |
||
55 | * Checks to see if the variable is non numeric or not |
||
56 | * @param mixed $variable This should be the variable you are testing if it is a number or not |
||
57 | * @return boolean Returns true if non numeric else returns false |
||
58 | */ |
||
59 | public static function isRequiredNonNumeric($variable) { |
||
65 | |||
66 | /** |
||
67 | * Remove anything that isn't a number from a string |
||
68 | * @param string $string This should be the string that you want to remove any none numerical characters from |
||
69 | * @return string The filtered string is returned |
||
70 | */ |
||
71 | public static function removeNoneNumeric($string) { |
||
74 | |||
75 | /** |
||
76 | * Removes anything that isn't in the alphabet A-Z |
||
77 | * @param string $string This should be the string that you want to remove all none alphabetical characters |
||
78 | * @return string The filtered string is returned |
||
79 | */ |
||
80 | public static function removeNoneAlpha($string) { |
||
83 | |||
84 | /** |
||
85 | * Removes all non Alpha-numeric characters from a string |
||
86 | * @param string $string The string that you want to remove any non alpha-numerical characters from |
||
87 | * @return string The filtered string is returned |
||
88 | */ |
||
89 | public static function removeNoneAlphaNumeric($string) { |
||
92 | |||
93 | /** |
||
94 | * Checks to see if array contains all of the required fields and are not empty |
||
95 | * @param array $mustContain an array of the values that must be included in the array |
||
96 | * @param array $valueArray The array you are checking for the values |
||
97 | * @return boolean If all of the fields exist and are not empty will return true else returns false |
||
98 | */ |
||
99 | public static function arrayMustContainFields($mustContain, $valueArray) { |
||
110 | } |