/** * @param NumberFormat $other * @return NumberFormat */ public function mergeFrom(NumberFormat $other) { if ($other->hasPattern()) { $this->setPattern($other->getPattern()); } if ($other->hasFormat()) { $this->setFormat($other->getFormat()); } $leadingDigitsPatternSize = $other->leadingDigitsPatternSize(); for ($i = 0; $i < $leadingDigitsPatternSize; $i++) { $this->addLeadingDigitsPattern($other->getLeadingDigitsPattern($i)); } if ($other->hasNationalPrefixFormattingRule()) { $this->setNationalPrefixFormattingRule($other->getNationalPrefixFormattingRule()); } if ($other->hasDomesticCarrierCodeFormattingRule()) { $this->setDomesticCarrierCodeFormattingRule($other->getDomesticCarrierCodeFormattingRule()); } $this->setNationalPrefixOptionalWhenFormatting($other->isNationalPrefixOptionalWhenFormatting()); return $this; }