コード例 #1
0
 /**
  * Appends a formatter to the builder which will optionally format/parse.
  * <p>
  * This method has the same effect as appending each of the constituent
  * parts directly to this builder surrounded by an {@link #optionalStart()} and
  * {@link #optionalEnd()}.
  * <p>
  * The formatter will format if data is available for all the fields contained within it.
  * The formatter will parse if the string matches, otherwise no error is returned.
  *
  * @param DateTimeFormatter $formatter the formatter to add, not null
  * @return DateTimeFormatterBuilder this, for chaining, not null
  */
 public function appendOptional(DateTimeFormatter $formatter)
 {
     $this->appendInternal($formatter->toPrinterParser(true));
     return $this;
 }