Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit60f31d1

Browse files
committed
[Intl] Improved inline documentation
1 parentc2d37e6 commit60f31d1

File tree

4 files changed

+178
-113
lines changed

4 files changed

+178
-113
lines changed

‎src/Symfony/Component/Intl/Collator/StubCollator.php

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@
1717
useSymfony\Component\Intl\Locale\StubLocale;
1818

1919
/**
20-
* Provides a stub Collator for the 'en' locale.
20+
* Replacement for PHP's native {@link \Collator} class.
21+
*
22+
* The only methods currently supported in this class are:
23+
*
24+
* - {@link \__construct}
25+
* - {@link create}
26+
* - {@link asort}
27+
* - {@link getErrorCode}
28+
* - {@link getErrorMessage}
29+
* - {@link getLocale}
2130
*
2231
* @author Igor Wiedler <igor@wiedler.ch>
32+
* @author Bernhard Schussek <bschussek@gmail.com>
2333
*/
2434
class StubCollator
2535
{
26-
/** Attribute constants */
36+
/* Attribute constants */
2737
constFRENCH_COLLATION =0;
2838
constALTERNATE_HANDLING =1;
2939
constCASE_FIRST =2;
@@ -33,7 +43,7 @@ class StubCollator
3343
constHIRAGANA_QUATERNARY_MODE =6;
3444
constNUMERIC_COLLATION =7;
3545

36-
/** Attribute constants values */
46+
/* Attribute constants values */
3747
constDEFAULT_VALUE = -1;
3848

3949
constPRIMARY =0;
@@ -52,33 +62,33 @@ class StubCollator
5262
constLOWER_FIRST =24;
5363
constUPPER_FIRST =25;
5464

55-
/** Sorting options */
65+
/* Sorting options */
5666
constSORT_REGULAR =0;
5767
constSORT_NUMERIC =2;
5868
constSORT_STRING =1;
5969

6070
/**
6171
* Constructor
6272
*
63-
* @param string $locale The locale code
73+
* @param string $locale The locale code. The only currently supported locale is "en".
6474
*
65-
* @throws MethodArgumentValueNotImplementedException When $locale different than'en' is passed
75+
* @throws MethodArgumentValueNotImplementedException When $locale different than"en" is passed
6676
*/
6777
publicfunction__construct($locale)
6878
{
6979
if ('en' !=$locale) {
70-
thrownewMethodArgumentValueNotImplementedException(__METHOD__,'locale',$locale,'Only the\'en\'locale is supported');
80+
thrownewMethodArgumentValueNotImplementedException(__METHOD__,'locale',$locale,'Only the locale "en" is supported');
7181
}
7282
}
7383

7484
/**
7585
* Static constructor
7686
*
77-
* @param string $locale The locale code
87+
* @param string $locale The locale code. The only currently supported locale is "en".
7888
*
7989
* @return StubCollator
8090
*
81-
* @throws MethodArgumentValueNotImplementedException When $locale different than'en' is passed
91+
* @throws MethodArgumentValueNotImplementedException When $locale different than"en" is passed
8292
*/
8393
publicstaticfunctioncreate($locale)
8494
{
@@ -110,7 +120,7 @@ public function asort(&$array, $sortFlag = self::SORT_REGULAR)
110120
}
111121

112122
/**
113-
* Compare two Unicode strings
123+
*Not supported.Compare two Unicode strings
114124
*
115125
* @param string $str1 The first string to compare
116126
* @param string $str2 The second string to compare
@@ -130,7 +140,7 @@ public function compare($str1, $str2)
130140
}
131141

132142
/**
133-
* Get a value of an integer collator attribute
143+
*Not supported.Get a value of an integer collator attribute
134144
*
135145
* @param int $attr An attribute specifier, one of the attribute constants
136146
*
@@ -168,17 +178,18 @@ public function getErrorMessage()
168178
/**
169179
* Returns the collator's locale
170180
*
171-
* @param int $type The locale name type to returnbetween valid or actual (StubLocale::VALID_LOCALE orStubLocale::ACTUAL_LOCALE, respectively)
181+
* @param int $typeNot supported.The locale name type to return(Locale::VALID_LOCALE orLocale::ACTUAL_LOCALE)
172182
*
173-
* @return string The locale name used to create the collator
183+
* @return string The locale used to create the collator. Currently always
184+
* returns "en".
174185
*/
175186
publicfunctiongetLocale($type = StubLocale::ACTUAL_LOCALE)
176187
{
177188
return'en';
178189
}
179190

180191
/**
181-
* Get sorting key for a string
192+
*Not supported.Get sorting key for a string
182193
*
183194
* @param string $string The string to produce the key from
184195
*
@@ -194,7 +205,7 @@ public function getSortKey($string)
194205
}
195206

196207
/**
197-
* Get current collator's strength
208+
*Not supported.Get current collator's strength
198209
*
199210
* @return Boolean|int The current collator's strength or false on failure
200211
*
@@ -208,7 +219,7 @@ public function getStrength()
208219
}
209220

210221
/**
211-
* Set a collator's attribute
222+
*Not supported.Set a collator's attribute
212223
*
213224
* @param int $attr An attribute specifier, one of the attribute constants
214225
* @param int $val The attribute value, one of the attribute value constants
@@ -225,7 +236,7 @@ public function setAttribute($attr, $val)
225236
}
226237

227238
/**
228-
* Set the collator's strength
239+
*Not supported.Set the collator's strength
229240
*
230241
* @param int $strength Strength to set, possible values:
231242
* StubCollator::PRIMARY
@@ -247,7 +258,7 @@ public function setStrength($strength)
247258
}
248259

249260
/**
250-
* Sort array using specified collator and sort keys
261+
*Not supported.Sort array using specified collator and sort keys
251262
*
252263
* @param array &$arr Array of strings to sort
253264
*
@@ -263,7 +274,7 @@ public function sortWithSortKeys(&$arr)
263274
}
264275

265276
/**
266-
* Sort array using specified collator
277+
*Not supported.Sort array using specified collator
267278
*
268279
* @param array &$arr Array of string to sort
269280
* @param int $sortFlag Optional sorting type, one of the following:

‎src/Symfony/Component/Intl/DateFormatter/StubIntlDateFormatter.php

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,30 @@
1919
useSymfony\Component\Intl\Locale\StubLocale;
2020

2121
/**
22-
* Provides a stub IntlDateFormatter for the 'en' locale.
22+
* Replacement for PHP's native {@link \IntlDateFormatter} class.
23+
*
24+
* The only methods currently supported in this class are:
25+
*
26+
* - {@link __construct}
27+
* - {@link create}
28+
* - {@link format}
29+
* - {@link getCalendar}
30+
* - {@link getDateType}
31+
* - {@link getErrorCode}
32+
* - {@link getErrorMessage}
33+
* - {@link getLocale}
34+
* - {@link getPattern}
35+
* - {@link getTimeType}
36+
* - {@link getTimeZoneId}
37+
* - {@link isLenient}
38+
* - {@link parse}
39+
* - {@link setLenient}
40+
* - {@link setPattern}
41+
* - {@link setTimeZoneId}
42+
* - {@link setTimeZone}
2343
*
2444
* @author Igor Wiedler <igor@wiedler.ch>
45+
* @author Bernhard Schussek <bschussek@gmail.com>
2546
*/
2647
class StubIntlDateFormatter
2748
{
@@ -108,24 +129,24 @@ class StubIntlDateFormatter
108129
/**
109130
* Constructor
110131
*
111-
* @param string $locale The locale code
132+
* @param string $locale The locale code. The only currently supported locale is "en".
112133
* @param int $datetype Type of date formatting, one of the format type constants
113134
* @param int $timetype Type of time formatting, one of the format type constants
114135
* @param string $timezone Timezone identifier
115-
* @param int $calendar Calendar to use for formatting or parsing; default is Gregorian.
116-
* One of the calendar constants.
136+
* @param int $calendar Calendar to use for formatting or parsing. The only currently
137+
*supported value is IntlDateFormatter::GREGORIAN.
117138
* @param string $pattern Optional pattern to use when formatting
118139
*
119140
* @see http://www.php.net/manual/en/intldateformatter.create.php
120141
* @see http://userguide.icu-project.org/formatparse/datetime
121142
*
122-
* @throws MethodArgumentValueNotImplementedException When $locale different than'en' is passed
143+
* @throws MethodArgumentValueNotImplementedException When $locale different than"en" is passed
123144
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
124145
*/
125146
publicfunction__construct($locale,$datetype,$timetype,$timezone =null,$calendar =self::GREGORIAN,$pattern =null)
126147
{
127148
if ('en' !==$locale) {
128-
thrownewMethodArgumentValueNotImplementedException(__METHOD__,'locale',$locale,'Only the\'en\'locale is supported');
149+
thrownewMethodArgumentValueNotImplementedException(__METHOD__,'locale',$locale,'Only the locale "en" is supported');
129150
}
130151

131152
if (self::GREGORIAN !==$calendar) {
@@ -142,7 +163,7 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
142163
/**
143164
* Static constructor
144165
*
145-
* @param string $locale The locale code
166+
* @param string $locale The locale code. The only currently supported locale is "en".
146167
* @param int $datetype Type of date formatting, one of the format type constants
147168
* @param int $timetype Type of time formatting, one of the format type constants
148169
* @param string $timezone Timezone identifier
@@ -155,7 +176,8 @@ public function __construct($locale, $datetype, $timetype, $timezone = null, $ca
155176
* @see http://www.php.net/manual/en/intldateformatter.create.php
156177
* @see http://userguide.icu-project.org/formatparse/datetime
157178
*
158-
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
179+
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
180+
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
159181
*/
160182
publicstaticfunctioncreate($locale,$datetype,$timetype,$timezone =null,$calendar =self::GREGORIAN,$pattern =null)
161183
{
@@ -165,9 +187,10 @@ public static function create($locale, $datetype, $timetype, $timezone = null, $
165187
/**
166188
* Format the date/time value (timestamp) as a string
167189
*
168-
* @param mixed $timestamp Unix timestamp to format
190+
* @param integer|\DateTime $timestamp The timestamp to format. \DateTime objects
191+
* are supported as of PHP 5.3.4.
169192
*
170-
* @return string The formatted value
193+
* @return string|Boolean The formatted value or false if formatting failed.
171194
*
172195
* @see http://www.php.net/manual/en/intldateformatter.format.php
173196
*
@@ -220,7 +243,7 @@ public function format($timestamp)
220243
}
221244

222245
/**
223-
* Formats an object
246+
*Not supported.Formats an object
224247
*
225248
* @param object $object
226249
* @param mixed $format
@@ -240,7 +263,8 @@ public function formatObject($object, $format = null, $locale = null)
240263
/**
241264
* Returns the formatter's calendar
242265
*
243-
* @return int The calendar being used by the formatter
266+
* @return int The calendar being used by the formatter. Currently always returns
267+
* IntlDateFormatter::GREGORIAN.
244268
*
245269
* @see http://www.php.net/manual/en/intldateformatter.getcalendar.php
246270
*/
@@ -250,7 +274,7 @@ public function getCalendar()
250274
}
251275

252276
/**
253-
* Returns the formatter's calendar object
277+
*Not supported.Returns the formatter's calendar object
254278
*
255279
* @return object The calendar's object being used by the formatter
256280
*
@@ -302,9 +326,10 @@ public function getErrorMessage()
302326
/**
303327
* Returns the formatter's locale
304328
*
305-
* @param int $type The locale name type to returnbetween valid or actual (StubLocale::VALID_LOCALE orStubLocale::ACTUAL_LOCALE, respectively)
329+
* @param int $typeNot supported.The locale name type to return(Locale::VALID_LOCALE orLocale::ACTUAL_LOCALE)
306330
*
307-
* @return string The locale name used to create the formatter
331+
* @return string The locale used to create the formatter. Currently always
332+
* returns "en".
308333
*
309334
* @see http://www.php.net/manual/en/intldateformatter.getlocale.php
310335
*/
@@ -359,7 +384,7 @@ public function getTimeZoneId()
359384
}
360385

361386
/**
362-
* Returns the formatter's timezone
387+
*Not supported.Returns the formatter's timezone
363388
*
364389
* @return mixed The timezone used by the formatter
365390
*
@@ -375,7 +400,7 @@ public function getTimeZone()
375400
/**
376401
* Returns whether the formatter is lenient
377402
*
378-
* @return Boolean
403+
* @return Boolean Currently always returns false.
379404
*
380405
* @see http://www.php.net/manual/en/intldateformatter.islenient.php
381406
*
@@ -387,7 +412,7 @@ public function isLenient()
387412
}
388413

389414
/**
390-
* Parse string to a field-based time value
415+
*Not supported.Parse string to a field-based time value
391416
*
392417
* @param string $value String to convert to a time value
393418
* @param int $position Position at which to start the parsing in $value (zero-based).
@@ -410,16 +435,16 @@ public function localtime($value, &$position = 0)
410435
* Parse string to a timestamp value
411436
*
412437
* @param string $value String to convert to a time value
413-
* @param int $position Position at which to start the parsing in $value (zero-based).
414-
*If no error occurs before $value is consumed, $parse_pos will
415-
*contain -1 otherwise it will contain the position at which parsing
416-
*ended. If $parse_pos > strlen($value), the parse fails immediately.
438+
* @param int $positionNot supported.Position at which to start the parsing in $value (zero-based).
439+
* If no error occurs before $value is consumed, $parse_pos will
440+
* contain -1 otherwise it will contain the position at which parsing
441+
* ended. If $parse_pos > strlen($value), the parse fails immediately.
417442
*
418443
* @return string Parsed value as a timestamp
419444
*
420445
* @see http://www.php.net/manual/en/intldateformatter.parse.php
421446
*
422-
* @throws MethodArgumentNotImplementedExceptionWhen $position different than null, behavior not implemented
447+
* @throws MethodArgumentNotImplementedException When $position different than null, behavior not implemented
423448
*/
424449
publicfunctionparse($value, &$position =null)
425450
{
@@ -441,7 +466,7 @@ public function parse($value, &$position = null)
441466
}
442467

443468
/**
444-
* Set the formatter's calendar
469+
*Not supported.Set the formatter's calendar
445470
*
446471
* @param string $calendar The calendar to use. Default is IntlDateFormatter::GREGORIAN.
447472
*
@@ -464,7 +489,8 @@ public function setCalendar($calendar)
464489
* patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or
465490
* invalid values ("February 30th") are not accepted.
466491
*
467-
* @param Boolean $lenient Sets whether the parser is lenient or not, default is false (strict)
492+
* @param Boolean $lenient Sets whether the parser is lenient or not. Currently
493+
* only false (strict) is supported.
468494
*
469495
* @return Boolean true on success or false on failure
470496
*
@@ -477,6 +503,8 @@ public function setLenient($lenient)
477503
if ($lenient) {
478504
thrownewMethodArgumentValueNotImplementedException(__METHOD__,'lenient',$lenient,'Only the strict parser is supported');
479505
}
506+
507+
returntrue;
480508
}
481509

482510
/**
@@ -496,6 +524,8 @@ public function setPattern($pattern)
496524
}
497525

498526
$this->pattern =$pattern;
527+
528+
returntrue;
499529
}
500530

501531
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp