| Conditions | 7 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | protected function validateCastValue($val) |
||
| 12 | { |
||
| 13 | if (!is_array($val)) { |
||
| 14 | $val = explode('-', $val); |
||
| 15 | } |
||
| 16 | if (count($val) != 2) { |
||
| 17 | throw $this->getValidationException(null, $val); |
||
| 18 | } else { |
||
| 19 | list($year, $month) = $val; |
||
| 20 | if ($year == '' || $month == '') { |
||
| 21 | throw $this->getValidationException(null, $val); |
||
| 22 | } else { |
||
| 23 | $year = (int) $year; |
||
| 24 | $month = (int) $month; |
||
| 25 | if ($month < 1 || $month > 12) { |
||
| 26 | throw $this->getValidationException(null, $val); |
||
| 27 | } else { |
||
| 28 | return $this->getNativeYearMonth($year, $month); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 44 |