|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Facades for Yii 2 |
|
4
|
|
|
* |
|
5
|
|
|
* Generated on Yii 2.0.12 |
|
6
|
|
|
* |
|
7
|
|
|
* @see https://github.com/sergeymakinen/yii2-facades |
|
8
|
|
|
* @copyright Copyright (c) 2016-2017 Sergey Makinen (https://makinen.ru) |
|
9
|
|
|
* @license https://github.com/sergeymakinen/yii2-facades/blob/master/LICENSE The MIT License |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace sergeymakinen\facades; |
|
13
|
|
|
|
|
14
|
|
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ |
|
15
|
|
|
/** |
|
16
|
|
|
* Yii::$app->get('formatter') facade. |
|
17
|
|
|
* |
|
18
|
|
|
* Methods |
|
19
|
|
|
* |
|
20
|
|
|
* @method static string asBoolean(mixed $value) Formats the value as a boolean. |
|
21
|
|
|
* @see \yii\i18n\Formatter::asBoolean |
|
22
|
|
|
* |
|
23
|
|
|
* @method static string asCurrency(mixed $value, string $currency = null, array $options = [], array $textOptions = []) Formats the value as a currency number. |
|
24
|
|
|
* @see \yii\i18n\Formatter::asCurrency |
|
25
|
|
|
* |
|
26
|
|
|
* @method static string asDate(int|string|\DateTime $value, string $format = null) Formats the value as a date. |
|
27
|
|
|
* @see \yii\i18n\Formatter::asDate |
|
28
|
|
|
* |
|
29
|
|
|
* @method static string asDatetime(int|string|\DateTime $value, string $format = null) Formats the value as a datetime. |
|
30
|
|
|
* @see \yii\i18n\Formatter::asDatetime |
|
31
|
|
|
* |
|
32
|
|
|
* @method static string asDecimal(mixed $value, int $decimals = null, array $options = [], array $textOptions = []) Formats the value as a decimal number. |
|
33
|
|
|
* @see \yii\i18n\Formatter::asDecimal |
|
34
|
|
|
* |
|
35
|
|
|
* @method static string asDuration(\DateInterval|string|int $value, string $implodeString = ', ', string $negativeSign = '-') Represents the value as duration in human readable format. |
|
36
|
|
|
* @see \yii\i18n\Formatter::asDuration |
|
37
|
|
|
* |
|
38
|
|
|
* @method static string asEmail(string $value, array $options = []) Formats the value as a mailto link. |
|
39
|
|
|
* @see \yii\i18n\Formatter::asEmail |
|
40
|
|
|
* |
|
41
|
|
|
* @method static string asHtml(string $value, array|null $config = null) Formats the value as HTML text. |
|
42
|
|
|
* @see \yii\i18n\Formatter::asHtml |
|
43
|
|
|
* |
|
44
|
|
|
* @method static string asImage(mixed $value, array $options = []) Formats the value as an image tag. |
|
45
|
|
|
* @see \yii\i18n\Formatter::asImage |
|
46
|
|
|
* |
|
47
|
|
|
* @method static string asInteger(mixed $value, array $options = [], array $textOptions = []) Formats the value as an integer number by removing any decimal digits without rounding. |
|
48
|
|
|
* @see \yii\i18n\Formatter::asInteger |
|
49
|
|
|
* |
|
50
|
|
|
* @method static string asNtext(string $value) Formats the value as an HTML-encoded plain text with newlines converted into breaks. |
|
51
|
|
|
* @see \yii\i18n\Formatter::asNtext |
|
52
|
|
|
* |
|
53
|
|
|
* @method static string asOrdinal(mixed $value) Formats the value as a ordinal value of a number. |
|
54
|
|
|
* @see \yii\i18n\Formatter::asOrdinal |
|
55
|
|
|
* |
|
56
|
|
|
* @method static string asParagraphs(string $value) Formats the value as HTML-encoded text paragraphs. |
|
57
|
|
|
* @see \yii\i18n\Formatter::asParagraphs |
|
58
|
|
|
* |
|
59
|
|
|
* @method static string asPercent(mixed $value, int $decimals = null, array $options = [], array $textOptions = []) Formats the value as a percent number with "%" sign. |
|
60
|
|
|
* @see \yii\i18n\Formatter::asPercent |
|
61
|
|
|
* |
|
62
|
|
|
* @method static string asRaw(mixed $value) Formats the value as is without any formatting. |
|
63
|
|
|
* @see \yii\i18n\Formatter::asRaw |
|
64
|
|
|
* |
|
65
|
|
|
* @method static string asRelativeTime(int|string|\DateTime|\DateInterval $value, int|string|\DateTime $referenceTime = null) Formats the value as the time interval between a date and now in human readable form. |
|
66
|
|
|
* @see \yii\i18n\Formatter::asRelativeTime |
|
67
|
|
|
* |
|
68
|
|
|
* @method static string asScientific(mixed $value, int $decimals = null, array $options = [], array $textOptions = []) Formats the value as a scientific number. |
|
69
|
|
|
* @see \yii\i18n\Formatter::asScientific |
|
70
|
|
|
* |
|
71
|
|
|
* @method static string asShortSize(string|int|float $value, int $decimals = null, array $options = [], array $textOptions = []) Formats the value in bytes as a size in human readable form for example `12 KB`. |
|
72
|
|
|
* @see \yii\i18n\Formatter::asShortSize |
|
73
|
|
|
* |
|
74
|
|
|
* @method static string asSize(string|int|float $value, int $decimals = null, array $options = [], array $textOptions = []) Formats the value in bytes as a size in human readable form, for example `12 kilobytes`. |
|
75
|
|
|
* @see \yii\i18n\Formatter::asSize |
|
76
|
|
|
* |
|
77
|
|
|
* @method static string asSpellout(mixed $value) Formats the value as a number spellout. |
|
78
|
|
|
* @see \yii\i18n\Formatter::asSpellout |
|
79
|
|
|
* |
|
80
|
|
|
* @method static string asText(string $value) Formats the value as an HTML-encoded plain text. |
|
81
|
|
|
* @see \yii\i18n\Formatter::asText |
|
82
|
|
|
* |
|
83
|
|
|
* @method static string asTime(int|string|\DateTime $value, string $format = null) Formats the value as a time. |
|
84
|
|
|
* @see \yii\i18n\Formatter::asTime |
|
85
|
|
|
* |
|
86
|
|
|
* @method static string asTimestamp(int|string|\DateTime $value) Formats a date, time or datetime in a float number as UNIX timestamp (seconds since 01-01-1970). |
|
87
|
|
|
* @see \yii\i18n\Formatter::asTimestamp |
|
88
|
|
|
* |
|
89
|
|
|
* @method static string asUrl(mixed $value, array $options = []) Formats the value as a hyperlink. |
|
90
|
|
|
* @see \yii\i18n\Formatter::asUrl |
|
91
|
|
|
* |
|
92
|
|
|
* @method static \yii\base\Behavior attachBehavior(string $name, string|array|\yii\base\Behavior $behavior) Attaches a behavior to this component. |
|
93
|
|
|
* @see \yii\base\Component::attachBehavior |
|
94
|
|
|
* |
|
95
|
|
|
* @method static void attachBehaviors(array $behaviors) Attaches a list of behaviors to the component. |
|
96
|
|
|
* @see \yii\base\Component::attachBehaviors |
|
97
|
|
|
* |
|
98
|
|
|
* @method static array behaviors() Returns a list of behaviors that this component should behave as. |
|
99
|
|
|
* @see \yii\base\Component::behaviors |
|
100
|
|
|
* |
|
101
|
|
|
* @method static null|\yii\base\Behavior detachBehavior(string $name) Detaches a behavior from the component. |
|
102
|
|
|
* @see \yii\base\Component::detachBehavior |
|
103
|
|
|
* |
|
104
|
|
|
* @method static void detachBehaviors() Detaches all behaviors from the component. |
|
105
|
|
|
* @see \yii\base\Component::detachBehaviors |
|
106
|
|
|
* |
|
107
|
|
|
* @method static void ensureBehaviors() Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. |
|
108
|
|
|
* @see \yii\base\Component::ensureBehaviors |
|
109
|
|
|
* |
|
110
|
|
|
* @method static string format(mixed $value, string|array $format) Formats the value based on the given format type. |
|
111
|
|
|
* @see \yii\i18n\Formatter::format |
|
112
|
|
|
* |
|
113
|
|
|
* @method static null|\yii\base\Behavior getBehavior(string $name) Returns the named behavior object. |
|
114
|
|
|
* @see \yii\base\Component::getBehavior |
|
115
|
|
|
* |
|
116
|
|
|
* @method static \yii\base\Behavior[] getBehaviors() Returns all behaviors attached to this component. |
|
117
|
|
|
* @see \yii\base\Component::getBehaviors |
|
118
|
|
|
* |
|
119
|
|
|
* @method static bool hasEventHandlers(string $name) Returns a value indicating whether there is any handler attached to the named event. |
|
120
|
|
|
* @see \yii\base\Component::hasEventHandlers |
|
121
|
|
|
* |
|
122
|
|
|
* @method static bool off(string $name, callable $handler = null) Detaches an existing event handler from this component. |
|
123
|
|
|
* @see \yii\base\Component::off |
|
124
|
|
|
* |
|
125
|
|
|
* @method static void on(string $name, callable $handler, mixed $data = null, bool $append = true) Attaches an event handler to an event. |
|
126
|
|
|
* @see \yii\base\Component::on |
|
127
|
|
|
* |
|
128
|
|
|
* @method static void trigger(string $name, \yii\base\Event $event = null) Triggers an event. |
|
129
|
|
|
* @see \yii\base\Component::trigger |
|
130
|
|
|
* |
|
131
|
|
|
* Property accessors |
|
132
|
|
|
* |
|
133
|
|
|
* @method static array getBooleanFormat() Returns the text to be displayed when formatting a boolean value. |
|
134
|
|
|
* @see \yii\i18n\Formatter::booleanFormat |
|
135
|
|
|
* |
|
136
|
|
|
* @method static \IntlCalendar|int|null getCalendar() Returns the calendar to be used for date formatting. |
|
137
|
|
|
* @see \yii\i18n\Formatter::calendar |
|
138
|
|
|
* |
|
139
|
|
|
* @method static string getCurrencyCode() Returns the 3-letter ISO 4217 currency code indicating the default currency to use for [[asCurrency]]. |
|
140
|
|
|
* @see \yii\i18n\Formatter::currencyCode |
|
141
|
|
|
* |
|
142
|
|
|
* @method static string getDateFormat() Returns the default format string to be used to format a [[asDate()|date]]. |
|
143
|
|
|
* @see \yii\i18n\Formatter::dateFormat |
|
144
|
|
|
* |
|
145
|
|
|
* @method static string getDatetimeFormat() Returns the default format string to be used to format a [[asDatetime()|date and time]]. |
|
146
|
|
|
* @see \yii\i18n\Formatter::datetimeFormat |
|
147
|
|
|
* |
|
148
|
|
|
* @method static string getDecimalSeparator() Returns the character displayed as the decimal point when formatting a number. |
|
149
|
|
|
* @see \yii\i18n\Formatter::decimalSeparator |
|
150
|
|
|
* |
|
151
|
|
|
* @method static string getDefaultTimeZone() Returns the time zone that is assumed for input values if they do not include a time zone explicitly. |
|
152
|
|
|
* @see \yii\i18n\Formatter::defaultTimeZone |
|
153
|
|
|
* |
|
154
|
|
|
* @method static string getLocale() Returns the locale ID that is used to localize the date and number formatting. |
|
155
|
|
|
* @see \yii\i18n\Formatter::locale |
|
156
|
|
|
* |
|
157
|
|
|
* @method static string getNullDisplay() Returns the text to be displayed when formatting a `null` value. |
|
158
|
|
|
* @see \yii\i18n\Formatter::nullDisplay |
|
159
|
|
|
* |
|
160
|
|
|
* @method static array getNumberFormatterOptions() Returns a list of name value pairs that are passed to the intl [NumberFormatter::setAttribute()](http://php.net/manual/en/numberformatter.setattribute.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
161
|
|
|
* @see \yii\i18n\Formatter::numberFormatterOptions |
|
162
|
|
|
* |
|
163
|
|
|
* @method static array getNumberFormatterSymbols() Returns a list of name value pairs that are passed to the intl [NumberFormatter::setSymbol()](http://php.net/manual/en/numberformatter.setsymbol.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
164
|
|
|
* @see \yii\i18n\Formatter::numberFormatterSymbols |
|
165
|
|
|
* |
|
166
|
|
|
* @method static array getNumberFormatterTextOptions() Returns a list of name value pairs that are passed to the intl [NumberFormatter::setTextAttribute()](http://php.net/manual/en/numberformatter.settextattribute.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
167
|
|
|
* @see \yii\i18n\Formatter::numberFormatterTextOptions |
|
168
|
|
|
* |
|
169
|
|
|
* @method static int getSizeFormatBase() Returns the base at which a kilobyte is calculated (1000 or 1024 bytes per kilobyte), used by [[asSize]] and [[asShortSize]]. |
|
170
|
|
|
* @see \yii\i18n\Formatter::sizeFormatBase |
|
171
|
|
|
* |
|
172
|
|
|
* @method static string getThousandSeparator() Returns the character displayed as the thousands separator (also called grouping separator) character when formatting a number. |
|
173
|
|
|
* @see \yii\i18n\Formatter::thousandSeparator |
|
174
|
|
|
* |
|
175
|
|
|
* @method static string getTimeFormat() Returns the default format string to be used to format a [[asTime()|time]]. |
|
176
|
|
|
* @see \yii\i18n\Formatter::timeFormat |
|
177
|
|
|
* |
|
178
|
|
|
* @method static string getTimeZone() Returns the time zone to use for formatting time and date values. |
|
179
|
|
|
* @see \yii\i18n\Formatter::timeZone |
|
180
|
|
|
* |
|
181
|
|
|
* @method static void setBooleanFormat(array $value) Sets the text to be displayed when formatting a boolean value. |
|
182
|
|
|
* @see \yii\i18n\Formatter::booleanFormat |
|
183
|
|
|
* |
|
184
|
|
|
* @method static void setCalendar(\IntlCalendar|int|null $value) Sets the calendar to be used for date formatting. |
|
185
|
|
|
* @see \yii\i18n\Formatter::calendar |
|
186
|
|
|
* |
|
187
|
|
|
* @method static void setCurrencyCode(string $value) Sets the 3-letter ISO 4217 currency code indicating the default currency to use for [[asCurrency]]. |
|
188
|
|
|
* @see \yii\i18n\Formatter::currencyCode |
|
189
|
|
|
* |
|
190
|
|
|
* @method static void setDateFormat(string $value) Sets the default format string to be used to format a [[asDate()|date]]. |
|
191
|
|
|
* @see \yii\i18n\Formatter::dateFormat |
|
192
|
|
|
* |
|
193
|
|
|
* @method static void setDatetimeFormat(string $value) Sets the default format string to be used to format a [[asDatetime()|date and time]]. |
|
194
|
|
|
* @see \yii\i18n\Formatter::datetimeFormat |
|
195
|
|
|
* |
|
196
|
|
|
* @method static void setDecimalSeparator(string $value) Sets the character displayed as the decimal point when formatting a number. |
|
197
|
|
|
* @see \yii\i18n\Formatter::decimalSeparator |
|
198
|
|
|
* |
|
199
|
|
|
* @method static void setDefaultTimeZone(string $value) Sets the time zone that is assumed for input values if they do not include a time zone explicitly. |
|
200
|
|
|
* @see \yii\i18n\Formatter::defaultTimeZone |
|
201
|
|
|
* |
|
202
|
|
|
* @method static void setLocale(string $value) Sets the locale ID that is used to localize the date and number formatting. |
|
203
|
|
|
* @see \yii\i18n\Formatter::locale |
|
204
|
|
|
* |
|
205
|
|
|
* @method static void setNullDisplay(string $value) Sets the text to be displayed when formatting a `null` value. |
|
206
|
|
|
* @see \yii\i18n\Formatter::nullDisplay |
|
207
|
|
|
* |
|
208
|
|
|
* @method static void setNumberFormatterOptions(array $value) Sets a list of name value pairs that are passed to the intl [NumberFormatter::setAttribute()](http://php.net/manual/en/numberformatter.setattribute.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
209
|
|
|
* @see \yii\i18n\Formatter::numberFormatterOptions |
|
210
|
|
|
* |
|
211
|
|
|
* @method static void setNumberFormatterSymbols(array $value) Sets a list of name value pairs that are passed to the intl [NumberFormatter::setSymbol()](http://php.net/manual/en/numberformatter.setsymbol.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
212
|
|
|
* @see \yii\i18n\Formatter::numberFormatterSymbols |
|
213
|
|
|
* |
|
214
|
|
|
* @method static void setNumberFormatterTextOptions(array $value) Sets a list of name value pairs that are passed to the intl [NumberFormatter::setTextAttribute()](http://php.net/manual/en/numberformatter.settextattribute.php) method of all the number formatter objects created by [[createNumberFormatter()]]. |
|
215
|
|
|
* @see \yii\i18n\Formatter::numberFormatterTextOptions |
|
216
|
|
|
* |
|
217
|
|
|
* @method static void setSizeFormatBase(int $value) Sets the base at which a kilobyte is calculated (1000 or 1024 bytes per kilobyte), used by [[asSize]] and [[asShortSize]]. |
|
218
|
|
|
* @see \yii\i18n\Formatter::sizeFormatBase |
|
219
|
|
|
* |
|
220
|
|
|
* @method static void setThousandSeparator(string $value) Sets the character displayed as the thousands separator (also called grouping separator) character when formatting a number. |
|
221
|
|
|
* @see \yii\i18n\Formatter::thousandSeparator |
|
222
|
|
|
* |
|
223
|
|
|
* @method static void setTimeFormat(string $value) Sets the default format string to be used to format a [[asTime()|time]]. |
|
224
|
|
|
* @see \yii\i18n\Formatter::timeFormat |
|
225
|
|
|
* |
|
226
|
|
|
* @method static void setTimeZone(string $value) Sets the time zone to use for formatting time and date values. |
|
227
|
|
|
* @see \yii\i18n\Formatter::timeZone |
|
228
|
|
|
*/ |
|
229
|
|
|
class Formatter extends Facade |
|
230
|
|
|
{ |
|
231
|
|
|
/** |
|
232
|
|
|
* @inheritDoc |
|
233
|
|
|
*/ |
|
234
|
1 |
|
public static function getFacadeComponentId() |
|
235
|
|
|
{ |
|
236
|
1 |
|
return 'formatter'; |
|
237
|
|
|
} |
|
238
|
|
|
} |
|
239
|
|
|
|