| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php defined('SYSPATH') OR die('No direct script access.'); |
||
| 13 | 1 | public function validate(Jam_Validated $model, $attribute, $value) |
|
| 14 | { |
||
| 15 | 1 | $promo_code = $this->valid_promo_code($value); |
|
| 16 | |||
| 17 | 1 | if ( ! $promo_code) |
|
| 18 | { |
||
| 19 | 1 | $model->errors()->add('promo_code_text', 'invalid'); |
|
| 20 | } |
||
| 21 | 1 | elseif ($promo_code->is_expired()) |
|
| 22 | { |
||
| 23 | 1 | $model->errors()->add('promo_code_text', 'expired'); |
|
| 24 | } |
||
| 25 | 1 | } |
|
| 26 | |||
| 35 |