/** * @expectedException \Celest\IllegalArgumentException */ public function test_print_pattern_localzed_narrow_standalone() { $this->builder->appendLocalizedOffset(TextStyle::NARROW_STANDALONE()); }
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; } }