protected static function format(string $phone='') {
		foreach (static::FORMATS as $k=>$v) {
			if (\preg_match("/^($k)$/", $phone)) {
				return \preg_replace("/^$k$/", $v, $phone);
			}
		}

		// No formatting.
		return $phone;
	}
protected static function format(string $phone='') {
		foreach (static::FORMATS as $k=>$v) {
			if (\preg_match("/^($k)$/", $phone)) {
				return \preg_replace("/^$k$/", $v, $phone);
			}
		}

		// No formatting.
		return $phone;
	}
protected static function format ( string $ phone = '' ) { foreach ( static :: FORMATS as $ k => $ v ) { if ( \ preg_match ( "/^($k)$/" , $ phone ) ) { return \ preg_replace ( "/^$k$/" , $ v , $ phone ) ; } } // No formatting. return $ phone ; }
Apply formatting rules.

@param string $phone Phone number.
@return string Phone number.
Apply formatting rules .