1 | <?php |
||
11 | class StringValidator extends AbstractFormatValidator |
||
12 | { |
||
13 | /** |
||
14 | * Validate that the input is a valid string. |
||
15 | * |
||
16 | * @access protected |
||
17 | * |
||
18 | * @return boolean Whether the input is valid. |
||
19 | */ |
||
20 | 1 | protected function formatDefault() |
|
24 | |||
25 | |||
26 | /** |
||
27 | * Validate that the input is a valid email address. |
||
28 | * |
||
29 | * @access protected |
||
30 | * |
||
31 | * @return boolean Whether the input is valid. |
||
32 | */ |
||
33 | 1 | protected function formatEmail() |
|
37 | |||
38 | |||
39 | /** |
||
40 | * Validate that the input is a valid URI. |
||
41 | * Although the specification for a URI states |
||
42 | * that it must have a scheme i.e. "http://" @see http://www.faqs.org/rfcs/rfc2396.html |
||
43 | * |
||
44 | * This validator allows the input to miss this off so an input |
||
45 | * of "www.example.com" will be passed as valid. |
||
46 | * |
||
47 | * @access protected |
||
48 | * |
||
49 | * @return boolean Whether the input is valid. |
||
50 | */ |
||
51 | 1 | protected function formatUri() |
|
61 | |||
62 | |||
63 | /** |
||
64 | * Validate that the input is a valid binary string. |
||
65 | * As PHP treats all stings as binary, this is currently just a check that the input is a string. |
||
66 | * TODO: Find a better way of validating that the string is a binary. |
||
67 | * |
||
68 | * @access protected |
||
69 | * |
||
70 | * @return boolean Whether the input is valid. |
||
71 | */ |
||
72 | protected function formatBinary() |
||
76 | } |
||
77 |