Code Duplication    Length = 16-17 lines in 2 locations

src/date/DateFormat.class.php 2 locations

@@ 901-916 (lines=16) @@
898
                        break;
899
900
                    case self::T_MONTH:
901
                    case self::T_SA_MONTH:
902
                        if ($count == 3) {
903
                            $months = $locale->getCalendarMonthsAbbreviated($calendarType);
904
                        } elseif ($count == 4) {
905
                            $months = $locale->getCalendarMonthsWide($calendarType);
906
                        } elseif ($count == 5) {
907
                            $months = $locale->getCalendarMonthsNarrow($calendarType);
908
                        }
909
                        $month = null;
910
                        if ($this->matchStringWithFallbacks($dateString, $months, $datePos, $month)) {
911
                            $cal->set(DateDefinitions::MONTH, $month - 1);
912
                        } else {
913
                            throw new AgaviException('Unknown character in "' . $dateString . '" at pos ' . $datePos . ' (expected one of: ' . implode(', ', $months) . ')');
914
                        }
915
916
                        break;
917
918
                    case self::T_QUARTER:
919
                    case self::T_SA_QUARTER:
@@ 919-935 (lines=17) @@
916
                        break;
917
918
                    case self::T_QUARTER:
919
                    case self::T_SA_QUARTER:
920
                        if ($count == 3) {
921
                            $quarters = $locale->getCalendarQuartersAbbreviated($calendarType);
922
                        } elseif ($count == 4) {
923
                            $quarters = $locale->getCalendarQuartersWide($calendarType);
924
                        } elseif ($count == 5) {
925
                            $quarters = $locale->getCalendarQuartersNarrow($calendarType);
926
                        }
927
                        $quarter = null;
928
                        if ($this->matchStringWithFallbacks($dateString, $quarters, $datePos, $quarter)) {
929
                            if (!$cal->_isSet(DateDefinitions::MONTH)) {
930
                                $cal->set(DateDefinitions::MONTH, ($quarter - 1) * 3);
931
                            }
932
                        } else {
933
                            throw new AgaviException('Unknown character in "' . $dateString . '" at pos ' . $datePos . ' (expected one of: ' . implode(', ', $quarters) . ')');
934
                        }
935
                        break;
936
                }
937
            }
938
        }