<commit_before><?php
namespace BrPack;

class Formatter extends \CLocalizedFormatter {

	/**
	 * Formats a string as a phone number with area code.
	 * @param $number
	 * @throws \CException In case the given value does not have 10~11 digits
	 * @return string
	 */
	public function formatPhone($number) {
		if (!preg_match('/^\d{10,11}$/', $number))
			throw new \CException('Phone formatter expects a string with 10~11 digits (area code + 8~9 digits).');

		return sprintf('(%d) %d-%d', substr($number, 0, 2), substr($number, 2, -4), substr($number, -4));
	}

	/**
	 * Formats a CPF number with dots and dashes.
	 * @param $number
	 * @throws \CException In case the given value does not have 11 digits
	 * @return string
	 */
	public function formatCpf($number) {
		if (!preg_match('/^\d{11}$/', $number))
			throw new \CException('CPF formatter expects a string with exact 11 digits.');

		return vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($number));
	}

	/**
	 * Alias for money formatting, using the `numberFormatter` standard component.
	 * @see \CNumberFormatter::formatCurrency()
	 * @param string|int|float $value    the number to be formatted
	 * @param string           $currency 3-letter ISO 4217 code
	 * @return string
	 */
	public function formatMoney($value, $currency = 'BRL') {
		return \Yii::app()->numberFormatter->formatCurrency($value, $currency);
	}

}<commit_msg>Fixing left zero wrongly trimmed<commit_after><?php
namespace BrPack;

class Formatter extends \CLocalizedFormatter {

	/**
	 * Formats a string as a phone number with area code.
	 * @param $number
	 * @throws \CException In case the given value does not have 10~11 digits
	 * @return string
	 */
	public function formatPhone($number) {
		if (!preg_match('/^\d{10,11}$/', $number))
			throw new \CException('Phone formatter expects a string with 10~11 digits (area code + 8~9 digits).');

		return sprintf('(%s) %s-%s', substr($number, 0, 2), substr($number, 2, -4), substr($number, -4));
	}

	/**
	 * Formats a CPF number with dots and dashes.
	 * @param $number
	 * @throws \CException In case the given value does not have 11 digits
	 * @return string
	 */
	public function formatCpf($number) {
		if (!preg_match('/^\d{11}$/', $number))
			throw new \CException('CPF formatter expects a string with exact 11 digits.');

		return vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($number));
	}

	/**
	 * Alias for money formatting, using the `numberFormatter` standard component.
	 * @see \CNumberFormatter::formatCurrency()
	 * @param string|int|float $value    the number to be formatted
	 * @param string           $currency 3-letter ISO 4217 code
	 * @return string
	 */
	public function formatMoney($value, $currency = 'BRL') {
		return \Yii::app()->numberFormatter->formatCurrency($value, $currency);
	}

}
{'fraction_non_alphanumeric': 0.1483065953654189, 'fraction_numerical': 0.0213903743315508, 'mean_word_length': 3.9314586994727594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2834645', 'n_tokens_mistral': 980, 'n_tokens_neox': 864, 'n_words': 292}