Interface.php
103 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Interface Tribe__Validator__Interface |
| 5 | * |
| 6 | * Models any class that provides methods to validate values. |
| 7 | */ |
| 8 | interface Tribe__Validator__Interface { |
| 9 | /** |
| 10 | * @param mixed $value |
| 11 | * |
| 12 | * @return bool |
| 13 | */ |
| 14 | public function is_numeric( $value ); |
| 15 | |
| 16 | /** |
| 17 | * @param mixed $value |
| 18 | * |
| 19 | * @return bool |
| 20 | */ |
| 21 | public function is_string( $value ); |
| 22 | |
| 23 | /** |
| 24 | * Whether the value is a timestamp or a string parseable by the strtotime function or not. |
| 25 | * |
| 26 | * @param mixed $value |
| 27 | * |
| 28 | * @return bool |
| 29 | */ |
| 30 | public function is_time( $value ); |
| 31 | |
| 32 | /** |
| 33 | * Whether the value corresponds to an existing user ID or not. |
| 34 | * |
| 35 | * @param mixed $value |
| 36 | * |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function is_user_id( $value ); |
| 40 | |
| 41 | /** |
| 42 | * Whether the value is a positive integer or not. |
| 43 | * |
| 44 | * @param mixed $value |
| 45 | * |
| 46 | * @return bool |
| 47 | */ |
| 48 | public function is_positive_int( $value ); |
| 49 | |
| 50 | /** |
| 51 | * Trims a string. |
| 52 | * |
| 53 | * Differently from the trim method it will not use the second argument. |
| 54 | * |
| 55 | * @param string $value |
| 56 | * |
| 57 | * @return string |
| 58 | */ |
| 59 | public function trim( $value ); |
| 60 | |
| 61 | /** |
| 62 | * Whether the value(s) all map to existing post tags. |
| 63 | * |
| 64 | * @param mixed $tag |
| 65 | * |
| 66 | * @return bool |
| 67 | */ |
| 68 | public function is_post_tag( $tag ); |
| 69 | |
| 70 | /** |
| 71 | * Whether the term exists and is a term of the specified taxonomy. |
| 72 | * |
| 73 | * @param mixed $term Either a single term `term_id` or `slug` or an array of |
| 74 | * `term_id`s and `slug`s |
| 75 | * @param string $taxonomy |
| 76 | * |
| 77 | * @return bool |
| 78 | */ |
| 79 | public function is_term_of_taxonomy( $term, $taxonomy ); |
| 80 | |
| 81 | /** |
| 82 | * Whether the provided value points to an existing attachment ID or an existing image URL. |
| 83 | * |
| 84 | * @param int|string $image |
| 85 | * |
| 86 | * @return mixed |
| 87 | */ |
| 88 | public function is_image( $image ); |
| 89 | |
| 90 | /** |
| 91 | * Whether a list or array of only contains positive integers or not. |
| 92 | * |
| 93 | * @since 4.7.19 |
| 94 | * |
| 95 | * @param string|array $list |
| 96 | * @param string $sep The separator used in the list to separate the elements; ignored if |
| 97 | * the input value is an array. |
| 98 | * |
| 99 | * @return bool |
| 100 | */ |
| 101 | public function is_positive_int_list( $list, $sep = ',' ); |
| 102 | } |
| 103 |