コード例 #1
0
ファイル: ZoneIdTest.php プロジェクト: celest-time/prototype
 public function test_constant_UTC()
 {
     $test = ZoneOffset::UTC();
     $this->assertEquals($test->getId(), "Z");
     $this->assertEquals($test->getDisplayName(TextStyle::FULL(), Locale::UK()), "Z");
     $this->assertEquals($test->getRules()->isFixedOffset(), true);
     $this->assertEquals($test->getRules()->getOffset(Instant::ofEpochSecond(0)), ZoneOffset::UTC());
     $this->checkOffset($test->getRules(), $this->createLDT(2008, 6, 30), ZoneOffset::UTC(), 1);
 }
コード例 #2
0
 public function test_toString2()
 {
     $this->assertEquals("Text(MonthOfYear,SHORT)", $this->getFormatterFieldStyle(ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT())->__toString());
 }
コード例 #3
0
 public function __toString()
 {
     if ($this->textStyle == TextStyle::FULL()) {
         return "Text(" . $this->field . ")";
     }
     return "Text(" . $this->field . "," . $this->textStyle . ")";
 }
コード例 #4
0
 /**
  * @expectedException \Celest\IllegalArgumentException
  */
 public function test_print_pattern_localzed_narrow_standalone()
 {
     $this->builder->appendLocalizedOffset(TextStyle::NARROW_STANDALONE());
 }
コード例 #5
0
 /**
  * @dataProvider data_offsetBasedValidPrefix
  */
 public function test_factory_of_String_offsetBasedValid_prefixUT($input, $id, $offsetId)
 {
     $test = ZoneId::of("UT" . $input);
     $this->assertEquals($test->getId(), "UT" . $id);
     $this->assertEquals($test->getRules(), ZoneOffset::of($offsetId)->getRules());
     $this->assertEquals($test->normalized(), ZoneOffset::of($offsetId));
     $this->assertEquals($test->getRules()->isFixedOffset(), true);
     $this->assertEquals($test->getRules()->getOffset(Instant::EPOCH()), ZoneOffset::of($offsetId));
     if (defined('HHVM_VERSION')) {
         $this->markTestSkipped('See https://github.com/facebook/hhvm/issues/6852');
     }
     $this->assertEquals($test->getDisplayName(TextStyle::FULL(), Locale::UK()), $this->displayName("UT" . $id));
 }
コード例 #6
0
 protected function getTree(DateTimeParseContext $context)
 {
     if ($this->textStyle == TextStyle::NARROW()) {
         return parent::getTree($context);
     }
     $locale = $context->getLocale();
     $isCaseSensitive = $context->isCaseSensitive();
     $regionIds = ZoneRulesProvider::getAvailableZoneIds();
     $regionIdsSize = $regionIds->size();
     $cached = $isCaseSensitive ? self::$cachedTree : self::$cachedTreeCI;
     $entry = null;
     $tree = null;
     $zoneStrings = null;
     if (($entry = $cached->get($locale)) == null || ($entry->getKey() != $regionIdsSize || ($tree = $entry->getValue()->get()) == null)) {
         $tree = PrefixTree::newTree($context);
         $zoneStrings = TimeZoneNameUtility::getZoneStrings($locale);
         foreach ($zoneStrings as $names) {
             $zid = $names[0];
             if (!$regionIds->contains($zid)) {
                 continue;
             }
             $tree->add($zid, $zid);
             // don't convert zid -> metazone
             $zid = ZoneName::toZid($zid, $locale);
             $i = $this->textStyle == TextStyle::FULL() ? 1 : 2;
             for (; $i < count($names); $i += 2) {
                 $tree->add($names[$i], $zid);
             }
         }
         // if we have a set of preferred zones, need a copy and
         // add the preferred zones again to overwrite
         if (self::$preferredZones != null) {
             foreach ($zoneStrings as $names) {
                 $zid = $names[0];
                 if (!self::$preferredZones->contains($zid) || !$regionIds->contains($zid)) {
                     continue;
                 }
                 $i = $this->textStyle == TextStyle::FULL() ? 1 : 2;
                 for (; $i < count($names); $i += 2) {
                     $tree->add($names[$i], $zid);
                 }
             }
         }
         $cached->put($locale, new SimpleImmutableEntry($regionIdsSize, $tree));
     }
     return $tree;
 }
コード例 #7
0
 public function test_appendZoneText_1arg()
 {
     $this->builder->appendZoneText(TextStyle::FULL());
     $f = $this->builder->toFormatter();
     $this->assertEquals($f->__toString(), "ZoneText(FULL)");
 }
コード例 #8
0
 public function data_text()
 {
     return [[ChronoField::DAY_OF_WEEK(), 1, TextStyle::SHORT(), self::enUS(), "Mon"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::SHORT(), self::enUS(), "Tue"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::SHORT(), self::enUS(), "Wed"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::SHORT(), self::enUS(), "Thu"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::SHORT(), self::enUS(), "Fri"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::SHORT(), self::enUS(), "Sat"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::SHORT(), self::enUS(), "Sun"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::SHORT(), self::ptBR(), "seg"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::SHORT(), self::ptBR(), "ter"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::SHORT(), self::ptBR(), "qua"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::SHORT(), self::ptBR(), "qui"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::SHORT(), self::ptBR(), "sex"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::SHORT(), self::ptBR(), "sáb"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::SHORT(), self::ptBR(), "dom"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::FULL(), self::enUS(), "Monday"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::FULL(), self::enUS(), "Tuesday"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::FULL(), self::enUS(), "Wednesday"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::FULL(), self::enUS(), "Thursday"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::FULL(), self::enUS(), "Friday"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::FULL(), self::enUS(), "Saturday"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::FULL(), self::enUS(), "Sunday"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::FULL(), self::ptBR(), "segunda-feira"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::FULL(), self::ptBR(), "terça-feira"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::FULL(), self::ptBR(), "quarta-feira"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::FULL(), self::ptBR(), "quinta-feira"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::FULL(), self::ptBR(), "sexta-feira"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::FULL(), self::ptBR(), "sábado"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::FULL(), self::ptBR(), "domingo"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::SHORT(), self::enUS(), "Jan"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::SHORT(), self::enUS(), "Feb"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::SHORT(), self::enUS(), "Mar"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::SHORT(), self::enUS(), "Apr"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::SHORT(), self::enUS(), "May"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::SHORT(), self::enUS(), "Jun"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::SHORT(), self::enUS(), "Jul"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::SHORT(), self::enUS(), "Aug"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::SHORT(), self::enUS(), "Sep"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::SHORT(), self::enUS(), "Oct"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::SHORT(), self::enUS(), "Nov"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::SHORT(), self::enUS(), "Dec"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::SHORT(), self::ptBR(), "jan"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::SHORT(), self::ptBR(), "fev"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::SHORT(), self::ptBR(), "mar"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::SHORT(), self::ptBR(), "abr"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::SHORT(), self::ptBR(), "mai"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::SHORT(), self::ptBR(), "jun"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::SHORT(), self::ptBR(), "jul"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::SHORT(), self::ptBR(), "ago"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::SHORT(), self::ptBR(), "set"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::SHORT(), self::ptBR(), "out"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::SHORT(), self::ptBR(), "nov"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::SHORT(), self::ptBR(), "dez"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::FULL(), self::enUS(), "January"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::FULL(), self::enUS(), "February"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::FULL(), self::enUS(), "March"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::FULL(), self::enUS(), "April"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::FULL(), self::enUS(), "May"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::FULL(), self::enUS(), "June"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::FULL(), self::enUS(), "July"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::FULL(), self::enUS(), "August"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::FULL(), self::enUS(), "September"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::FULL(), self::enUS(), "October"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::FULL(), self::enUS(), "November"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::FULL(), self::enUS(), "December"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::FULL(), self::ptBR(), "janeiro"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::FULL(), self::ptBR(), "fevereiro"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::FULL(), self::ptBR(), "março"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::FULL(), self::ptBR(), "abril"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::FULL(), self::ptBR(), "maio"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::FULL(), self::ptBR(), "junho"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::FULL(), self::ptBR(), "julho"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::FULL(), self::ptBR(), "agosto"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::FULL(), self::ptBR(), "setembro"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::FULL(), self::ptBR(), "outubro"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::FULL(), self::ptBR(), "novembro"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::FULL(), self::ptBR(), "dezembro"], [ChronoField::AMPM_OF_DAY(), 0, TextStyle::SHORT(), self::enUS(), "AM"], [ChronoField::AMPM_OF_DAY(), 1, TextStyle::SHORT(), self::enUS(), "PM"]];
 }
コード例 #9
0
 private function parse(DateTimeFormatter $fmt, $zid, $expected, $text, Locale $locale, TextStyle $style, $ci)
 {
     if ($ci) {
         $text = $text->toUpperCase();
     }
     /** @var ZoneId $ret */
     $ret = $fmt->parseQuery($text, TemporalQueries::zone())->getId();
     // TBD: need an excluding list
     // assertEquals(...);
     if ($ret->equals($expected) || $ret->equals($zid) || $ret->equals(ZoneName::toZid($zid)) || $ret->equals($expected->replace("UTC", "UCT"))) {
         return;
     }
     echo printf("[%-5s %s %s %16s] %24s -> %s(%s)%n", $locale->__toString(), $ci ? "ci" : "  ", $style == TextStyle::FULL() ? " full" : "short", $zid, $text, $ret, $expected);
 }
コード例 #10
0
 /**
  * @param $field
  * @param TextStyle $style
  * @param Locale $locale
  * @param callable $transformer
  * @return array|null
  */
 public static function tryFetchStyleValues($field, $style, Locale $locale, callable $transformer)
 {
     $bundle = new ResourceBundle($locale->getLocale(), null);
     if ($style === null) {
         $tmp = [];
         foreach (['stand-alone', 'format'] as $id) {
             foreach (['wide', 'abbreviated', 'narrow'] as $style) {
                 $values = $bundle['calendar']['gregorian'][$field][$id][$style];
                 if ($values === null) {
                     continue;
                 }
                 foreach ($values as $key => $value) {
                     $tmp[$value] = $transformer($key);
                 }
             }
         }
         return $tmp;
     }
     $id = $style->isStandalone() ? 'stand-alone' : 'format';
     $styles = [\IntlDateFormatter::FULL => 'wide', \IntlDateFormatter::MEDIUM => 'abbreviated', \IntlDateFormatter::SHORT => 'narrow'];
     $values = $bundle['calendar']['gregorian'][$field][$id][$styles[$style->toCalendarStyle()]];
     // fallback to stand alone if not found
     if ($values === null && $id === 'format') {
         $values = $bundle['calendar']['gregorian'][$field]['stand-alone'][$styles[$style->toCalendarStyle()]];
     }
     // ERA
     if ($values === null) {
         $values = $bundle['calendar']['gregorian'][$field][$styles[$style->toCalendarStyle()]];
     }
     // AMPM
     if ($values === null) {
         $values = $bundle['calendar']['gregorian'][$field];
     }
     if (!$values) {
         return null;
     }
     $tmp = [];
     foreach ($values as $key => $value) {
         $tmp[$value] = $transformer($key);
     }
     return $tmp;
 }
コード例 #11
0
 public function test_pattern_String()
 {
     $test = DateTimeFormatter::ofPattern("d MMM yyyy");
     $fmtLocale = Locale::getDefault();
     $this->assertEquals($test->format(LocalDate::of(2012, 6, 30)), "30 " . Month::JUNE()->getDisplayName(TextStyle::SHORT(), $fmtLocale) . " 2012");
     $this->assertEquals($test->getLocale(), $fmtLocale, "Locale.Category.FORMAT");
 }
コード例 #12
0
 public function test_getText_nullLocale()
 {
     TestHelper::assertNullException($this, function () {
         Month::JANUARY()->getDisplayName(TextStyle::FULL(), null);
     });
 }
コード例 #13
0
ファイル: TextStyle.php プロジェクト: celest-time/prototype
 /**
  * Returns the normal style with the same size.
  *
  * @return TextStyle the normal style with the same size
  */
 public function asNormal()
 {
     return TextStyle::values()[$this->ordinal & ~1];
 }
コード例 #14
0
 public function test_parse_short_lenient_number_match()
 {
     $this->setStrict(false);
     $pos = new ParsePosition(0);
     $this->assertEquals($this->getFormatterFieldStyle(ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT())->parseUnresolved("1", $pos)->getLong(ChronoField::MONTH_OF_YEAR()), 1);
     $this->assertEquals($pos->getIndex(), 1);
 }
コード例 #15
0
 public function test_getText_nullLocale()
 {
     TestHelper::assertNullException($this, function () {
         DayOfWeek::MONDAY()->getDisplayName(TextStyle::FULL(), null);
     });
 }
コード例 #16
0
 /**
  * @dataProvider data_text
  */
 public function test_appendText1arg_format(TemporalField $field, TextStyle $style, $value, $expected)
 {
     if ($style == TextStyle::FULL()) {
         $f = $this->builder->appendText($field)->toFormatter2(Locale::ENGLISH());
         $dt = LocalDateTime::of(2010, 1, 1, 0, 0);
         $dt = $dt->with($field, $value);
         $text = $f->format($dt);
         $this->assertEquals($text, $expected);
     }
 }
コード例 #17
0
 public function test_appendText_2arg_nullRule()
 {
     TestHelper::assertNullException($this, function () {
         $this->builder->appendText2(null, TextStyle::SHORT());
     });
 }
コード例 #18
0
 public function parse(DateTimeParseContext $context, $text, $position)
 {
     $pos = $position;
     $end = $pos + strlen($text);
     $gmtText = "GMT";
     // TODO: get localized version of 'GMT'
     if ($gmtText !== null) {
         if (!$context->subSequenceEquals($text, $pos, $gmtText, 0, strlen($gmtText))) {
             return ~$position;
         }
         $pos += strlen($gmtText);
     }
     // parse normal plus/minus offset
     if ($pos == $end) {
         return $context->setParsedField(ChronoField::OFFSET_SECONDS(), 0, $position, $pos);
     }
     $sign = $text[$pos];
     // IOOBE if invalid position
     if ($sign == '+') {
         $negative = 1;
     } else {
         if ($sign == '-') {
             $negative = -1;
         } else {
             return $context->setParsedField(ChronoField::OFFSET_SECONDS(), 0, $position, $pos);
         }
     }
     $pos++;
     $m = 0;
     $s = 0;
     if ($this->style == TextStyle::FULL()) {
         $h1 = $this->getDigit($text, $pos++);
         $h2 = $this->getDigit($text, $pos++);
         if ($h1 < 0 || $h2 < 0 || $text[$pos++] !== ':') {
             return ~$position;
         }
         $h = $h1 * 10 + $h2;
         $m1 = $this->getDigit($text, $pos++);
         $m2 = $this->getDigit($text, $pos++);
         if ($m1 < 0 || $m2 < 0) {
             return ~$position;
         }
         $m = $m1 * 10 + $m2;
         if ($pos + 2 < $end && $text[$pos] === ':') {
             $s1 = $this->getDigit($text, $pos + 1);
             $s2 = $this->getDigit($text, $pos + 2);
             if ($s1 >= 0 && $s2 >= 0) {
                 $s = $s1 * 10 + $s2;
                 $pos += 3;
             }
         }
     } else {
         $h = $this->getDigit($text, $pos++);
         if ($h < 0) {
             return ~$position;
         }
         if ($pos < $end) {
             $h2 = $this->getDigit($text, $pos);
             if ($h2 >= 0) {
                 $h = $h * 10 + $h2;
                 $pos++;
             }
             if ($pos + 2 < $end && $text[$pos] === ':') {
                 if ($pos + 2 < $end && $text[$pos] === ':') {
                     $m1 = $this->getDigit($text, $pos + 1);
                     $m2 = $this->getDigit($text, $pos + 2);
                     if ($m1 >= 0 && $m2 >= 0) {
                         $m = $m1 * 10 + $m2;
                         $pos += 3;
                         if ($pos + 2 < $end && $text[$pos] === ':') {
                             $s1 = $this->getDigit($text, $pos + 1);
                             $s2 = $this->getDigit($text, $pos + 2);
                             if ($s1 >= 0 && $s2 >= 0) {
                                 $s = $s1 * 10 + $s2;
                                 $pos += 3;
                             }
                         }
                     }
                 }
             }
         }
     }
     $offsetSecs = $negative * ($h * 3600 + $m * 60 + $s);
     return $context->setParsedField(ChronoField::OFFSET_SECONDS(), $offsetSecs, $position, $pos);
 }
コード例 #19
0
 private function parseField($cur, $count, TemporalField $field)
 {
     $standalone = false;
     switch ($cur) {
         case 'u':
         case 'y':
             if ($count === 2) {
                 $this->appendValueReduced2($field, 2, 2, ReducedPrinterParser::BASE_DATE());
             } else {
                 if ($count < 4) {
                     $this->appendValue3($field, $count, 19, SignStyle::NORMAL());
                 } else {
                     $this->appendValue3($field, $count, 19, SignStyle::EXCEEDS_PAD());
                 }
             }
             break;
             /** @noinspection PhpMissingBreakStatementInspection */
         /** @noinspection PhpMissingBreakStatementInspection */
         case 'c':
             if ($count === 2) {
                 throw new IllegalArgumentException("Invalid pattern \"cc\"");
             }
             /*fallthrough*/
         /*fallthrough*/
         case 'L':
             /** @noinspection PhpMissingBreakStatementInspection */
         /** @noinspection PhpMissingBreakStatementInspection */
         case 'q':
             $standalone = true;
             /*fallthrough*/
         /*fallthrough*/
         case 'M':
         case 'Q':
         case 'E':
         case 'e':
             switch ($count) {
                 case 1:
                 case 2:
                     if ($cur == 'c' || $cur == 'e') {
                         $this->appendInternal(new WeekBasedFieldPrinterParser($cur, $count));
                     } else {
                         if ($cur == 'E') {
                             $this->appendText2($field, TextStyle::SHORT());
                         } else {
                             if ($count === 1) {
                                 $this->appendValue($field);
                             } else {
                                 $this->appendValue2($field, 2);
                             }
                         }
                     }
                     break;
                 case 3:
                     $this->appendText2($field, $standalone ? TextStyle::SHORT_STANDALONE() : TextStyle::SHORT());
                     break;
                 case 4:
                     $this->appendText2($field, $standalone ? TextStyle::FULL_STANDALONE() : TextStyle::FULL());
                     break;
                 case 5:
                     $this->appendText2($field, $standalone ? TextStyle::NARROW_STANDALONE() : TextStyle::NARROW());
                     break;
                 default:
                     throw new IllegalArgumentException("Too many pattern letters: " . $cur);
             }
             break;
         case 'a':
             if ($count === 1) {
                 $this->appendText2($field, TextStyle::SHORT());
             } else {
                 throw new IllegalArgumentException("Too many pattern letters: " . $cur);
             }
             break;
         case 'G':
             switch ($count) {
                 case 1:
                 case 2:
                 case 3:
                     $this->appendText2($field, TextStyle::SHORT());
                     break;
                 case 4:
                     $this->appendText2($field, TextStyle::FULL());
                     break;
                 case 5:
                     $this->appendText2($field, TextStyle::NARROW());
                     break;
                 default:
                     throw new IllegalArgumentException("Too many pattern letters: " . $cur);
             }
             break;
         case 'S':
             $this->appendFraction(ChronoField::NANO_OF_SECOND(), $count, $count, false);
             break;
         case 'F':
             if ($count == 1) {
                 $this->appendValue($field);
             } else {
                 throw new IllegalArgumentException("Too many pattern letters: " . $cur);
             }
             break;
         case 'd':
         case 'h':
         case 'H':
         case 'k':
         case 'K':
         case 'm':
         case 's':
             if ($count === 1) {
                 $this->appendValue($field);
             } else {
                 if ($count === 2) {
                     $this->appendValue2($field, $count);
                 } else {
                     throw new IllegalArgumentException("Too many pattern letters: " . $cur);
                 }
             }
             break;
         case 'D':
             if ($count == 1) {
                 $this->appendValue($field);
             } else {
                 if ($count <= 3) {
                     $this->appendValue2($field, $count);
                 } else {
                     throw new IllegalArgumentException("Too many pattern letters: " . $cur);
                 }
             }
             break;
         default:
             if ($count == 1) {
                 $this->appendValue($field);
             } else {
                 $this->appendValue2($field, $count);
             }
             break;
     }
 }