1 | <?php |
||
11 | class DataValidator implements DataValidatorInterface |
||
12 | { |
||
13 | const DATA_TYPE_STRING = 'string'; |
||
14 | const DATA_TYPE_INTEGER = 'int'; |
||
15 | const DATA_TYPE_DECIMAL = 'decimal'; |
||
16 | const DATA_TYPE_DATE = 'date'; |
||
17 | const DATA_TYPE_DATETIME = 'datetime'; |
||
18 | |||
19 | /** |
||
20 | * Check if value exceed max length defined in mapping |
||
21 | * |
||
22 | * @param string $value |
||
23 | * @param int $maxlength |
||
24 | * |
||
25 | * @return bool |
||
26 | */ |
||
27 | 6 | public function validateLength($value, $maxlength) |
|
31 | |||
32 | /** |
||
33 | * Check if property type correspond to which declared in mapping |
||
34 | * |
||
35 | * @param mixed $value |
||
36 | * @param string $type |
||
37 | * |
||
38 | * @return bool true if valid value type or null value |
||
39 | */ |
||
40 | 7 | public function validateType($value, $type) |
|
59 | |||
60 | /** |
||
61 | * @param mixed $input |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 3 | public function isInteger($input) |
|
69 | |||
70 | /** |
||
71 | * test if parameter is containing a float |
||
72 | * |
||
73 | * @param mixed $value |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | 3 | public function isFloat($value) |
|
81 | |||
82 | /** |
||
83 | * Check the validity of a date or datetime format |
||
84 | * |
||
85 | * @param string $date |
||
86 | * @param string $format |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | 5 | public function validateDate($date, $format) |
|
96 | } |
||
97 |