Conditions | 3 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
29 | 7 | public function due_date($due) |
|
30 | { |
||
31 | //Verify date format |
||
32 | 7 | $date_pattern = '/(20|1[0-9])[0-9]{2}\-(1[0-2]|0[1-9])\-(3[0-1]|2[0-8]|1[0-9]|0[1-9])/'; |
|
33 | |||
34 | 7 | if ( ! (bool) preg_match($date_pattern, $due) && $due != 0) |
|
35 | 7 | { |
|
36 | 1 | $this->CI->form_validation->set_message('validate', 'You must enter a due date in YYYY-MM-DD format.'); |
|
37 | 1 | return FALSE; |
|
38 | } |
||
39 | |||
40 | 6 | return TRUE; |
|
41 | } |
||
42 | |||
79 | // End of libraries/Validation_callbacks.php |