|  |  |  | @ -30,21 +30,40 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $locale; | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a date using PHP date() function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a date. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $dateFormat = 'short'; | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a time using PHP date() function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a time. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $timeFormat = 'short'; | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a date and time using PHP date() function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the default format string to be used to format a date and time. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $datetimeFormat = 'short'; | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var array the options to be set for the NumberFormatter objects. Please refer to | 
			
		
	
		
			
				
					|  |  |  |  | 	 * [PHP manual](http://php.net/manual/en/class.numberformatter.php#intl.numberformatter-constants.unumberformatattribute) | 
			
		
	
		
			
				
					|  |  |  |  | 	 * for the possible options. This property is used by [[createNumberFormatter]] when | 
			
		
	
		
			
				
					|  |  |  |  | 	 * creating a new number formatter to format decimals, currencies, etc. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $numberFormatOptions = array(); | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the character displayed as the decimal point when formatting a number. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If not set, the decimal separator corresponding to [[locale]] will be used. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $decimalSeparator; | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @var string the character displayed as the thousands separator character when formatting a number. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If not set, the thousand separator corresponding to [[locale]] will be used. | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	public $thousandSeparator; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
	
		
			
				
					|  |  |  | @ -61,6 +80,16 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 		if ($this->locale === null) { | 
			
		
	
		
			
				
					|  |  |  |  | 			$this->locale = Yii::$app->language; | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		if ($this->decimalSeparator === null || $this->thousandSeparator === null) { | 
			
		
	
		
			
				
					|  |  |  |  | 			$formatter = new NumberFormatter($this->locale, NumberFormatter::DECIMAL); | 
			
		
	
		
			
				
					|  |  |  |  | 			if ($this->decimalSeparator === null) { | 
			
		
	
		
			
				
					|  |  |  |  | 				$this->decimalSeparator = $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			if ($this->thousandSeparator === null) { | 
			
		
	
		
			
				
					|  |  |  |  | 				$this->thousandSeparator = $formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 		parent::init(); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -81,8 +110,11 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	 * - a PHP DateTime object | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param string $format the format used to convert the value into a date string. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. The format string should be the one | 
			
		
	
		
			
				
					|  |  |  |  | 	 * that can be recognized by the PHP `date()` function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return string the formatted result | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @see dateFormat | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
	
		
			
				
					|  |  |  | @ -111,8 +143,11 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	 * - a PHP DateTime object | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param string $format the format used to convert the value into a date string. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. The format string should be the one | 
			
		
	
		
			
				
					|  |  |  |  | 	 * that can be recognized by the PHP `date()` function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return string the formatted result | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @see timeFormat | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
	
		
			
				
					|  |  |  | @ -141,8 +176,11 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	 * - a PHP DateTime object | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param string $format the format used to convert the value into a date string. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. The format string should be the one | 
			
		
	
		
			
				
					|  |  |  |  | 	 * that can be recognized by the PHP `date()` function. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * If null, [[dateFormat]] will be used. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). | 
			
		
	
		
			
				
					|  |  |  |  | 	 * | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return string the formatted result | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @see datetimeFormat | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
	
		
			
				
					|  |  |  | @ -213,7 +251,7 @@ class Formatter extends \yii\base\Formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	/** | 
			
		
	
		
			
				
					|  |  |  |  | 	 * Creates a number formatter based on the given type and format. | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param integer $type the type of the number formatter | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param string $format the format to be used | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param string $format the format to be used.  Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return NumberFormatter the created formatter instance | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	protected function createNumberFormatter($type, $format) | 
			
		
	
	
		
			
				
					|  |  |  | 
 |