[Intl] Improved inline documentation
This commit is contained in:
parent
c2d37e6291
commit
60f31d1004
@ -17,13 +17,23 @@ use Symfony\Component\Intl\Globals\StubIntlGlobals;
|
|||||||
use Symfony\Component\Intl\Locale\StubLocale;
|
use Symfony\Component\Intl\Locale\StubLocale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stub Collator for the 'en' locale.
|
* Replacement for PHP's native {@link \Collator} class.
|
||||||
|
*
|
||||||
|
* The only methods currently supported in this class are:
|
||||||
|
*
|
||||||
|
* - {@link \__construct}
|
||||||
|
* - {@link create}
|
||||||
|
* - {@link asort}
|
||||||
|
* - {@link getErrorCode}
|
||||||
|
* - {@link getErrorMessage}
|
||||||
|
* - {@link getLocale}
|
||||||
*
|
*
|
||||||
* @author Igor Wiedler <igor@wiedler.ch>
|
* @author Igor Wiedler <igor@wiedler.ch>
|
||||||
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class StubCollator
|
class StubCollator
|
||||||
{
|
{
|
||||||
/** Attribute constants */
|
/* Attribute constants */
|
||||||
const FRENCH_COLLATION = 0;
|
const FRENCH_COLLATION = 0;
|
||||||
const ALTERNATE_HANDLING = 1;
|
const ALTERNATE_HANDLING = 1;
|
||||||
const CASE_FIRST = 2;
|
const CASE_FIRST = 2;
|
||||||
@ -33,7 +43,7 @@ class StubCollator
|
|||||||
const HIRAGANA_QUATERNARY_MODE = 6;
|
const HIRAGANA_QUATERNARY_MODE = 6;
|
||||||
const NUMERIC_COLLATION = 7;
|
const NUMERIC_COLLATION = 7;
|
||||||
|
|
||||||
/** Attribute constants values */
|
/* Attribute constants values */
|
||||||
const DEFAULT_VALUE = -1;
|
const DEFAULT_VALUE = -1;
|
||||||
|
|
||||||
const PRIMARY = 0;
|
const PRIMARY = 0;
|
||||||
@ -52,7 +62,7 @@ class StubCollator
|
|||||||
const LOWER_FIRST = 24;
|
const LOWER_FIRST = 24;
|
||||||
const UPPER_FIRST = 25;
|
const UPPER_FIRST = 25;
|
||||||
|
|
||||||
/** Sorting options */
|
/* Sorting options */
|
||||||
const SORT_REGULAR = 0;
|
const SORT_REGULAR = 0;
|
||||||
const SORT_NUMERIC = 2;
|
const SORT_NUMERIC = 2;
|
||||||
const SORT_STRING = 1;
|
const SORT_STRING = 1;
|
||||||
@ -60,25 +70,25 @@ class StubCollator
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only currently supported locale is "en".
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
*/
|
*/
|
||||||
public function __construct($locale)
|
public function __construct($locale)
|
||||||
{
|
{
|
||||||
if ('en' != $locale) {
|
if ('en' != $locale) {
|
||||||
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the \'en\' locale is supported');
|
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static constructor
|
* Static constructor
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only currently supported locale is "en".
|
||||||
*
|
*
|
||||||
* @return StubCollator
|
* @return StubCollator
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
*/
|
*/
|
||||||
public static function create($locale)
|
public static function create($locale)
|
||||||
{
|
{
|
||||||
@ -110,7 +120,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two Unicode strings
|
* Not supported. Compare two Unicode strings
|
||||||
*
|
*
|
||||||
* @param string $str1 The first string to compare
|
* @param string $str1 The first string to compare
|
||||||
* @param string $str2 The second string to compare
|
* @param string $str2 The second string to compare
|
||||||
@ -130,7 +140,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a value of an integer collator attribute
|
* Not supported. Get a value of an integer collator attribute
|
||||||
*
|
*
|
||||||
* @param int $attr An attribute specifier, one of the attribute constants
|
* @param int $attr An attribute specifier, one of the attribute constants
|
||||||
*
|
*
|
||||||
@ -168,9 +178,10 @@ class StubCollator
|
|||||||
/**
|
/**
|
||||||
* Returns the collator's locale
|
* Returns the collator's locale
|
||||||
*
|
*
|
||||||
* @param int $type The locale name type to return between valid or actual (StubLocale::VALID_LOCALE or StubLocale::ACTUAL_LOCALE, respectively)
|
* @param int $type Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE)
|
||||||
*
|
*
|
||||||
* @return string The locale name used to create the collator
|
* @return string The locale used to create the collator. Currently always
|
||||||
|
* returns "en".
|
||||||
*/
|
*/
|
||||||
public function getLocale($type = StubLocale::ACTUAL_LOCALE)
|
public function getLocale($type = StubLocale::ACTUAL_LOCALE)
|
||||||
{
|
{
|
||||||
@ -178,7 +189,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sorting key for a string
|
* Not supported. Get sorting key for a string
|
||||||
*
|
*
|
||||||
* @param string $string The string to produce the key from
|
* @param string $string The string to produce the key from
|
||||||
*
|
*
|
||||||
@ -194,7 +205,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current collator's strength
|
* Not supported. Get current collator's strength
|
||||||
*
|
*
|
||||||
* @return Boolean|int The current collator's strength or false on failure
|
* @return Boolean|int The current collator's strength or false on failure
|
||||||
*
|
*
|
||||||
@ -208,7 +219,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a collator's attribute
|
* Not supported. Set a collator's attribute
|
||||||
*
|
*
|
||||||
* @param int $attr An attribute specifier, one of the attribute constants
|
* @param int $attr An attribute specifier, one of the attribute constants
|
||||||
* @param int $val The attribute value, one of the attribute value constants
|
* @param int $val The attribute value, one of the attribute value constants
|
||||||
@ -225,7 +236,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the collator's strength
|
* Not supported. Set the collator's strength
|
||||||
*
|
*
|
||||||
* @param int $strength Strength to set, possible values:
|
* @param int $strength Strength to set, possible values:
|
||||||
* StubCollator::PRIMARY
|
* StubCollator::PRIMARY
|
||||||
@ -247,7 +258,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort array using specified collator and sort keys
|
* Not supported. Sort array using specified collator and sort keys
|
||||||
*
|
*
|
||||||
* @param array &$arr Array of strings to sort
|
* @param array &$arr Array of strings to sort
|
||||||
*
|
*
|
||||||
@ -263,7 +274,7 @@ class StubCollator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort array using specified collator
|
* Not supported. Sort array using specified collator
|
||||||
*
|
*
|
||||||
* @param array &$arr Array of string to sort
|
* @param array &$arr Array of string to sort
|
||||||
* @param int $sortFlag Optional sorting type, one of the following:
|
* @param int $sortFlag Optional sorting type, one of the following:
|
||||||
|
@ -19,9 +19,30 @@ use Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException;
|
|||||||
use Symfony\Component\Intl\Locale\StubLocale;
|
use Symfony\Component\Intl\Locale\StubLocale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stub IntlDateFormatter for the 'en' locale.
|
* Replacement for PHP's native {@link \IntlDateFormatter} class.
|
||||||
|
*
|
||||||
|
* The only methods currently supported in this class are:
|
||||||
|
*
|
||||||
|
* - {@link __construct}
|
||||||
|
* - {@link create}
|
||||||
|
* - {@link format}
|
||||||
|
* - {@link getCalendar}
|
||||||
|
* - {@link getDateType}
|
||||||
|
* - {@link getErrorCode}
|
||||||
|
* - {@link getErrorMessage}
|
||||||
|
* - {@link getLocale}
|
||||||
|
* - {@link getPattern}
|
||||||
|
* - {@link getTimeType}
|
||||||
|
* - {@link getTimeZoneId}
|
||||||
|
* - {@link isLenient}
|
||||||
|
* - {@link parse}
|
||||||
|
* - {@link setLenient}
|
||||||
|
* - {@link setPattern}
|
||||||
|
* - {@link setTimeZoneId}
|
||||||
|
* - {@link setTimeZone}
|
||||||
*
|
*
|
||||||
* @author Igor Wiedler <igor@wiedler.ch>
|
* @author Igor Wiedler <igor@wiedler.ch>
|
||||||
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class StubIntlDateFormatter
|
class StubIntlDateFormatter
|
||||||
{
|
{
|
||||||
@ -108,24 +129,24 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only currently supported locale is "en".
|
||||||
* @param int $datetype Type of date formatting, one of the format type constants
|
* @param int $datetype Type of date formatting, one of the format type constants
|
||||||
* @param int $timetype Type of time formatting, one of the format type constants
|
* @param int $timetype Type of time formatting, one of the format type constants
|
||||||
* @param string $timezone Timezone identifier
|
* @param string $timezone Timezone identifier
|
||||||
* @param int $calendar Calendar to use for formatting or parsing; default is Gregorian.
|
* @param int $calendar Calendar to use for formatting or parsing. The only currently
|
||||||
* One of the calendar constants.
|
* supported value is IntlDateFormatter::GREGORIAN.
|
||||||
* @param string $pattern Optional pattern to use when formatting
|
* @param string $pattern Optional pattern to use when formatting
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/intldateformatter.create.php
|
* @see http://www.php.net/manual/en/intldateformatter.create.php
|
||||||
* @see http://userguide.icu-project.org/formatparse/datetime
|
* @see http://userguide.icu-project.org/formatparse/datetime
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
|
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
|
||||||
*/
|
*/
|
||||||
public function __construct($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null)
|
public function __construct($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null)
|
||||||
{
|
{
|
||||||
if ('en' !== $locale) {
|
if ('en' !== $locale) {
|
||||||
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the \'en\' locale is supported');
|
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::GREGORIAN !== $calendar) {
|
if (self::GREGORIAN !== $calendar) {
|
||||||
@ -142,7 +163,7 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Static constructor
|
* Static constructor
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only currently supported locale is "en".
|
||||||
* @param int $datetype Type of date formatting, one of the format type constants
|
* @param int $datetype Type of date formatting, one of the format type constants
|
||||||
* @param int $timetype Type of time formatting, one of the format type constants
|
* @param int $timetype Type of time formatting, one of the format type constants
|
||||||
* @param string $timezone Timezone identifier
|
* @param string $timezone Timezone identifier
|
||||||
@ -155,7 +176,8 @@ class StubIntlDateFormatter
|
|||||||
* @see http://www.php.net/manual/en/intldateformatter.create.php
|
* @see http://www.php.net/manual/en/intldateformatter.create.php
|
||||||
* @see http://userguide.icu-project.org/formatparse/datetime
|
* @see http://userguide.icu-project.org/formatparse/datetime
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
|
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
|
||||||
*/
|
*/
|
||||||
public static function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null)
|
public static function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null)
|
||||||
{
|
{
|
||||||
@ -165,9 +187,10 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Format the date/time value (timestamp) as a string
|
* Format the date/time value (timestamp) as a string
|
||||||
*
|
*
|
||||||
* @param mixed $timestamp Unix timestamp to format
|
* @param integer|\DateTime $timestamp The timestamp to format. \DateTime objects
|
||||||
|
* are supported as of PHP 5.3.4.
|
||||||
*
|
*
|
||||||
* @return string The formatted value
|
* @return string|Boolean The formatted value or false if formatting failed.
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/intldateformatter.format.php
|
* @see http://www.php.net/manual/en/intldateformatter.format.php
|
||||||
*
|
*
|
||||||
@ -220,7 +243,7 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats an object
|
* Not supported. Formats an object
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param object $object
|
||||||
* @param mixed $format
|
* @param mixed $format
|
||||||
@ -240,7 +263,8 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Returns the formatter's calendar
|
* Returns the formatter's calendar
|
||||||
*
|
*
|
||||||
* @return int The calendar being used by the formatter
|
* @return int The calendar being used by the formatter. Currently always returns
|
||||||
|
* IntlDateFormatter::GREGORIAN.
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/intldateformatter.getcalendar.php
|
* @see http://www.php.net/manual/en/intldateformatter.getcalendar.php
|
||||||
*/
|
*/
|
||||||
@ -250,7 +274,7 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the formatter's calendar object
|
* Not supported. Returns the formatter's calendar object
|
||||||
*
|
*
|
||||||
* @return object The calendar's object being used by the formatter
|
* @return object The calendar's object being used by the formatter
|
||||||
*
|
*
|
||||||
@ -302,9 +326,10 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Returns the formatter's locale
|
* Returns the formatter's locale
|
||||||
*
|
*
|
||||||
* @param int $type The locale name type to return between valid or actual (StubLocale::VALID_LOCALE or StubLocale::ACTUAL_LOCALE, respectively)
|
* @param int $type Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE)
|
||||||
*
|
*
|
||||||
* @return string The locale name used to create the formatter
|
* @return string The locale used to create the formatter. Currently always
|
||||||
|
* returns "en".
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/intldateformatter.getlocale.php
|
* @see http://www.php.net/manual/en/intldateformatter.getlocale.php
|
||||||
*/
|
*/
|
||||||
@ -359,7 +384,7 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the formatter's timezone
|
* Not supported. Returns the formatter's timezone
|
||||||
*
|
*
|
||||||
* @return mixed The timezone used by the formatter
|
* @return mixed The timezone used by the formatter
|
||||||
*
|
*
|
||||||
@ -375,7 +400,7 @@ class StubIntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Returns whether the formatter is lenient
|
* Returns whether the formatter is lenient
|
||||||
*
|
*
|
||||||
* @return Boolean
|
* @return Boolean Currently always returns false.
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/intldateformatter.islenient.php
|
* @see http://www.php.net/manual/en/intldateformatter.islenient.php
|
||||||
*
|
*
|
||||||
@ -387,7 +412,7 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse string to a field-based time value
|
* Not supported. Parse string to a field-based time value
|
||||||
*
|
*
|
||||||
* @param string $value String to convert to a time value
|
* @param string $value String to convert to a time value
|
||||||
* @param int $position Position at which to start the parsing in $value (zero-based).
|
* @param int $position Position at which to start the parsing in $value (zero-based).
|
||||||
@ -410,7 +435,7 @@ class StubIntlDateFormatter
|
|||||||
* Parse string to a timestamp value
|
* Parse string to a timestamp value
|
||||||
*
|
*
|
||||||
* @param string $value String to convert to a time value
|
* @param string $value String to convert to a time value
|
||||||
* @param int $position Position at which to start the parsing in $value (zero-based).
|
* @param int $position Not supported. Position at which to start the parsing in $value (zero-based).
|
||||||
* If no error occurs before $value is consumed, $parse_pos will
|
* If no error occurs before $value is consumed, $parse_pos will
|
||||||
* contain -1 otherwise it will contain the position at which parsing
|
* contain -1 otherwise it will contain the position at which parsing
|
||||||
* ended. If $parse_pos > strlen($value), the parse fails immediately.
|
* ended. If $parse_pos > strlen($value), the parse fails immediately.
|
||||||
@ -441,7 +466,7 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the formatter's calendar
|
* Not supported. Set the formatter's calendar
|
||||||
*
|
*
|
||||||
* @param string $calendar The calendar to use. Default is IntlDateFormatter::GREGORIAN.
|
* @param string $calendar The calendar to use. Default is IntlDateFormatter::GREGORIAN.
|
||||||
*
|
*
|
||||||
@ -464,7 +489,8 @@ class StubIntlDateFormatter
|
|||||||
* patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or
|
* patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or
|
||||||
* invalid values ("February 30th") are not accepted.
|
* invalid values ("February 30th") are not accepted.
|
||||||
*
|
*
|
||||||
* @param Boolean $lenient Sets whether the parser is lenient or not, default is false (strict)
|
* @param Boolean $lenient Sets whether the parser is lenient or not. Currently
|
||||||
|
* only false (strict) is supported.
|
||||||
*
|
*
|
||||||
* @return Boolean true on success or false on failure
|
* @return Boolean true on success or false on failure
|
||||||
*
|
*
|
||||||
@ -477,6 +503,8 @@ class StubIntlDateFormatter
|
|||||||
if ($lenient) {
|
if ($lenient) {
|
||||||
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'lenient', $lenient, 'Only the strict parser is supported');
|
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'lenient', $lenient, 'Only the strict parser is supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -496,6 +524,8 @@ class StubIntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->pattern = $pattern;
|
$this->pattern = $pattern;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,19 +16,23 @@ use Symfony\Component\Intl\Exception\NotImplementedException;
|
|||||||
use Symfony\Component\Intl\Exception\MethodNotImplementedException;
|
use Symfony\Component\Intl\Exception\MethodNotImplementedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stub Locale for the 'en' locale.
|
* Replacement for PHP's native {@link \Locale} class.
|
||||||
|
*
|
||||||
|
* The only method supported in this class is {@link getDefault}. This method
|
||||||
|
* will always return "en". All other methods will throw an exception when used.
|
||||||
*
|
*
|
||||||
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
||||||
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class StubLocale
|
class StubLocale
|
||||||
{
|
{
|
||||||
const DEFAULT_LOCALE = null;
|
const DEFAULT_LOCALE = null;
|
||||||
|
|
||||||
/** Locale method constants */
|
/* Locale method constants */
|
||||||
const ACTUAL_LOCALE = 0;
|
const ACTUAL_LOCALE = 0;
|
||||||
const VALID_LOCALE = 1;
|
const VALID_LOCALE = 1;
|
||||||
|
|
||||||
/** Language tags constants */
|
/* Language tags constants */
|
||||||
const LANG_TAG = 'language';
|
const LANG_TAG = 'language';
|
||||||
const EXTLANG_TAG = 'extlang';
|
const EXTLANG_TAG = 'extlang';
|
||||||
const SCRIPT_TAG = 'script';
|
const SCRIPT_TAG = 'script';
|
||||||
@ -38,7 +42,7 @@ class StubLocale
|
|||||||
const PRIVATE_TAG = 'private';
|
const PRIVATE_TAG = 'private';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the best available locale based on HTTP "Accept-Language" header according to RFC 2616
|
* Not supported. Returns the best available locale based on HTTP "Accept-Language" header according to RFC 2616
|
||||||
*
|
*
|
||||||
* @param string $header The string containing the "Accept-Language" header value
|
* @param string $header The string containing the "Accept-Language" header value
|
||||||
*
|
*
|
||||||
@ -54,7 +58,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a correctly ordered and delimited locale code
|
* Not supported. Returns a correctly ordered and delimited locale code
|
||||||
*
|
*
|
||||||
* @param array $subtags A keyed array where the keys identify the particular locale code subtag
|
* @param array $subtags A keyed array where the keys identify the particular locale code subtag
|
||||||
*
|
*
|
||||||
@ -70,7 +74,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a language tag filter matches with locale
|
* Not supported. Checks if a language tag filter matches with locale
|
||||||
*
|
*
|
||||||
* @param string $langtag The language tag to check
|
* @param string $langtag The language tag to check
|
||||||
* @param string $locale The language range to check against
|
* @param string $locale The language range to check against
|
||||||
@ -88,7 +92,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variants for the input locale
|
* Not supported. Returns the variants for the input locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale to extract the variants from
|
* @param string $locale The locale to extract the variants from
|
||||||
*
|
*
|
||||||
@ -109,8 +113,6 @@ class StubLocale
|
|||||||
* @return string The default locale code. Always returns 'en'
|
* @return string The default locale code. Always returns 'en'
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/locale.getdefault.php
|
* @see http://www.php.net/manual/en/locale.getdefault.php
|
||||||
*
|
|
||||||
* @throws MethodNotImplementedException
|
|
||||||
*/
|
*/
|
||||||
public static function getDefault()
|
public static function getDefault()
|
||||||
{
|
{
|
||||||
@ -118,7 +120,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the localized display name for the locale language
|
* Not supported. Returns the localized display name for the locale language
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to return the display language from
|
* @param string $locale The locale code to return the display language from
|
||||||
* @param string $inLocale Optional format locale code to use to display the language name
|
* @param string $inLocale Optional format locale code to use to display the language name
|
||||||
@ -135,7 +137,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the localized display name for the locale
|
* Not supported. Returns the localized display name for the locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to return the display locale name from
|
* @param string $locale The locale code to return the display locale name from
|
||||||
* @param string $inLocale Optional format locale code to use to display the locale name
|
* @param string $inLocale Optional format locale code to use to display the locale name
|
||||||
@ -152,7 +154,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the localized display name for the locale region
|
* Not supported. Returns the localized display name for the locale region
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to return the display region from
|
* @param string $locale The locale code to return the display region from
|
||||||
* @param string $inLocale Optional format locale code to use to display the region name
|
* @param string $inLocale Optional format locale code to use to display the region name
|
||||||
@ -169,7 +171,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the localized display name for the locale script
|
* Not supported. Returns the localized display name for the locale script
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to return the display script from
|
* @param string $locale The locale code to return the display script from
|
||||||
* @param string $inLocale Optional format locale code to use to display the script name
|
* @param string $inLocale Optional format locale code to use to display the script name
|
||||||
@ -186,7 +188,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the localized display name for the locale variant
|
* Not supported. Returns the localized display name for the locale variant
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to return the display variant from
|
* @param string $locale The locale code to return the display variant from
|
||||||
* @param string $inLocale Optional format locale code to use to display the variant name
|
* @param string $inLocale Optional format locale code to use to display the variant name
|
||||||
@ -203,7 +205,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the keywords for the locale
|
* Not supported. Returns the keywords for the locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to extract the keywords from
|
* @param string $locale The locale code to extract the keywords from
|
||||||
*
|
*
|
||||||
@ -219,7 +221,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the primary language for the locale
|
* Not supported. Returns the primary language for the locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to extract the language code from
|
* @param string $locale The locale code to extract the language code from
|
||||||
*
|
*
|
||||||
@ -235,7 +237,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the region for the locale
|
* Not supported. Returns the region for the locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to extract the region code from
|
* @param string $locale The locale code to extract the region code from
|
||||||
*
|
*
|
||||||
@ -251,7 +253,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the script for the locale
|
* Not supported. Returns the script for the locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to extract the script code from
|
* @param string $locale The locale code to extract the script code from
|
||||||
*
|
*
|
||||||
@ -267,7 +269,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest language tag for the locale
|
* Not supported. Returns the closest language tag for the locale
|
||||||
*
|
*
|
||||||
* @param array $langtag A list of the language tags to compare to locale
|
* @param array $langtag A list of the language tags to compare to locale
|
||||||
* @param string $locale The locale to use as the language range when matching
|
* @param string $locale The locale to use as the language range when matching
|
||||||
@ -284,7 +286,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an associative array of locale identifier subtags
|
* Not supported. Returns an associative array of locale identifier subtags
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code to extract the subtag array from
|
* @param string $locale The locale code to extract the subtag array from
|
||||||
*
|
*
|
||||||
@ -300,7 +302,7 @@ class StubLocale
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default runtime locale
|
* Not supported. Sets the default runtime locale
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code
|
||||||
*
|
*
|
||||||
|
@ -20,13 +20,27 @@ use Symfony\Component\Intl\Intl;
|
|||||||
use Symfony\Component\Intl\Locale\StubLocale;
|
use Symfony\Component\Intl\Locale\StubLocale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stub NumberFormatter for the 'en' locale.
|
* Replacement for PHP's native {@link \NumberFormatter} class.
|
||||||
|
*
|
||||||
|
* The only methods currently supported in this class are:
|
||||||
|
*
|
||||||
|
* - {@link __construct}
|
||||||
|
* - {@link create}
|
||||||
|
* - {@link formatCurrency}
|
||||||
|
* - {@link format}
|
||||||
|
* - {@link getAttribute}
|
||||||
|
* - {@link getErrorCode}
|
||||||
|
* - {@link getErrorMessage}
|
||||||
|
* - {@link getLocale}
|
||||||
|
* - {@link parse}
|
||||||
|
* - {@link setAttribute}
|
||||||
*
|
*
|
||||||
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
||||||
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class StubNumberFormatter
|
class StubNumberFormatter
|
||||||
{
|
{
|
||||||
/** Format style constants */
|
/* Format style constants */
|
||||||
const PATTERN_DECIMAL = 0;
|
const PATTERN_DECIMAL = 0;
|
||||||
const DECIMAL = 1;
|
const DECIMAL = 1;
|
||||||
const CURRENCY = 2;
|
const CURRENCY = 2;
|
||||||
@ -39,14 +53,14 @@ class StubNumberFormatter
|
|||||||
const IGNORE = 0;
|
const IGNORE = 0;
|
||||||
const DEFAULT_STYLE = 1;
|
const DEFAULT_STYLE = 1;
|
||||||
|
|
||||||
/** Format type constants */
|
/* Format type constants */
|
||||||
const TYPE_DEFAULT = 0;
|
const TYPE_DEFAULT = 0;
|
||||||
const TYPE_INT32 = 1;
|
const TYPE_INT32 = 1;
|
||||||
const TYPE_INT64 = 2;
|
const TYPE_INT64 = 2;
|
||||||
const TYPE_DOUBLE = 3;
|
const TYPE_DOUBLE = 3;
|
||||||
const TYPE_CURRENCY = 4;
|
const TYPE_CURRENCY = 4;
|
||||||
|
|
||||||
/** Numeric attribute constants */
|
/* Numeric attribute constants */
|
||||||
const PARSE_INT_ONLY = 0;
|
const PARSE_INT_ONLY = 0;
|
||||||
const GROUPING_USED = 1;
|
const GROUPING_USED = 1;
|
||||||
const DECIMAL_ALWAYS_SHOWN = 2;
|
const DECIMAL_ALWAYS_SHOWN = 2;
|
||||||
@ -68,7 +82,7 @@ class StubNumberFormatter
|
|||||||
const MAX_SIGNIFICANT_DIGITS = 18;
|
const MAX_SIGNIFICANT_DIGITS = 18;
|
||||||
const LENIENT_PARSE = 19;
|
const LENIENT_PARSE = 19;
|
||||||
|
|
||||||
/** Text attribute constants */
|
/* Text attribute constants */
|
||||||
const POSITIVE_PREFIX = 0;
|
const POSITIVE_PREFIX = 0;
|
||||||
const POSITIVE_SUFFIX = 1;
|
const POSITIVE_SUFFIX = 1;
|
||||||
const NEGATIVE_PREFIX = 2;
|
const NEGATIVE_PREFIX = 2;
|
||||||
@ -78,7 +92,7 @@ class StubNumberFormatter
|
|||||||
const DEFAULT_RULESET = 6;
|
const DEFAULT_RULESET = 6;
|
||||||
const PUBLIC_RULESETS = 7;
|
const PUBLIC_RULESETS = 7;
|
||||||
|
|
||||||
/** Format symbol constants */
|
/* Format symbol constants */
|
||||||
const DECIMAL_SEPARATOR_SYMBOL = 0;
|
const DECIMAL_SEPARATOR_SYMBOL = 0;
|
||||||
const GROUPING_SEPARATOR_SYMBOL = 1;
|
const GROUPING_SEPARATOR_SYMBOL = 1;
|
||||||
const PATTERN_SEPARATOR_SYMBOL = 2;
|
const PATTERN_SEPARATOR_SYMBOL = 2;
|
||||||
@ -98,7 +112,7 @@ class StubNumberFormatter
|
|||||||
const SIGNIFICANT_DIGIT_SYMBOL = 16;
|
const SIGNIFICANT_DIGIT_SYMBOL = 16;
|
||||||
const MONETARY_GROUPING_SEPARATOR_SYMBOL = 17;
|
const MONETARY_GROUPING_SEPARATOR_SYMBOL = 17;
|
||||||
|
|
||||||
/** Rounding mode values used by NumberFormatter::setAttribute() with NumberFormatter::ROUNDING_MODE attribute */
|
/* Rounding mode values used by NumberFormatter::setAttribute() with NumberFormatter::ROUNDING_MODE attribute */
|
||||||
const ROUND_CEILING = 0;
|
const ROUND_CEILING = 0;
|
||||||
const ROUND_FLOOR = 1;
|
const ROUND_FLOOR = 1;
|
||||||
const ROUND_DOWN = 2;
|
const ROUND_DOWN = 2;
|
||||||
@ -107,7 +121,7 @@ class StubNumberFormatter
|
|||||||
const ROUND_HALFDOWN = 5;
|
const ROUND_HALFDOWN = 5;
|
||||||
const ROUND_HALFUP = 6;
|
const ROUND_HALFUP = 6;
|
||||||
|
|
||||||
/** Pad position values used by NumberFormatter::setAttribute() with NumberFormatter::PADDING_POSITION attribute */
|
/* Pad position values used by NumberFormatter::setAttribute() with NumberFormatter::PADDING_POSITION attribute */
|
||||||
const PAD_BEFORE_PREFIX = 0;
|
const PAD_BEFORE_PREFIX = 0;
|
||||||
const PAD_AFTER_PREFIX = 1;
|
const PAD_AFTER_PREFIX = 1;
|
||||||
const PAD_BEFORE_SUFFIX = 2;
|
const PAD_BEFORE_SUFFIX = 2;
|
||||||
@ -127,11 +141,6 @@ class StubNumberFormatter
|
|||||||
*/
|
*/
|
||||||
protected $errorMessage = 'U_ZERO_ERROR';
|
protected $errorMessage = 'U_ZERO_ERROR';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
@ -224,11 +233,13 @@ class StubNumberFormatter
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only currently supported locale is "en".
|
||||||
* @param int $style Style of the formatting, one of the format style constants
|
* @param int $style Style of the formatting, one of the format style constants.
|
||||||
* @param string $pattern A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
* The only supported styles are NumberFormatter::DECIMAL
|
||||||
|
* and NumberFormatter::CURRENCY.
|
||||||
|
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
||||||
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
||||||
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
||||||
*
|
*
|
||||||
@ -236,14 +247,14 @@ class StubNumberFormatter
|
|||||||
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
||||||
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
|
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
|
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
|
||||||
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
|
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
|
||||||
*/
|
*/
|
||||||
public function __construct($locale = 'en', $style = null, $pattern = null)
|
public function __construct($locale = 'en', $style = null, $pattern = null)
|
||||||
{
|
{
|
||||||
if ('en' != $locale) {
|
if ('en' != $locale) {
|
||||||
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the \'en\' locale is supported');
|
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($style, self::$supportedStyles)) {
|
if (!in_array($style, self::$supportedStyles)) {
|
||||||
@ -255,16 +266,17 @@ class StubNumberFormatter
|
|||||||
throw new MethodArgumentNotImplementedException(__METHOD__, 'pattern');
|
throw new MethodArgumentNotImplementedException(__METHOD__, 'pattern');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->locale = $locale;
|
|
||||||
$this->style = $style;
|
$this->style = $style;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static constructor
|
* Static constructor.
|
||||||
*
|
*
|
||||||
* @param string $locale The locale code
|
* @param string $locale The locale code. The only supported locale is "en".
|
||||||
* @param int $style Style of the formatting, one of the format style constants
|
* @param int $style Style of the formatting, one of the format style constants.
|
||||||
* @param string $pattern A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
* The only currently supported styles are NumberFormatter::DECIMAL
|
||||||
|
* and NumberFormatter::CURRENCY.
|
||||||
|
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
||||||
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
||||||
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
||||||
*
|
*
|
||||||
@ -274,7 +286,7 @@ class StubNumberFormatter
|
|||||||
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
||||||
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
|
* @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details
|
||||||
*
|
*
|
||||||
* @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" is passed
|
||||||
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
|
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
|
||||||
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
|
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
|
||||||
*/
|
*/
|
||||||
@ -322,14 +334,15 @@ class StubNumberFormatter
|
|||||||
* Format a number
|
* Format a number
|
||||||
*
|
*
|
||||||
* @param number $value The value to format
|
* @param number $value The value to format
|
||||||
* @param int $type Type of the formatting, one of the format type constants
|
* @param int $type Type of the formatting, one of the format type constants.
|
||||||
|
* Only type NumberFormatter::TYPE_DEFAULT is currently supported.
|
||||||
*
|
*
|
||||||
* @return Boolean|string The formatted value or false on error
|
* @return Boolean|string The formatted value or false on error
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/numberformatter.format.php
|
* @see http://www.php.net/manual/en/numberformatter.format.php
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException If the method is called with the class $style 'CURRENCY'
|
* @throws NotImplementedException If the method is called with the class $style 'CURRENCY'
|
||||||
* @throws MethodArgumentNotImplementedException If the $type is different than TYPE_DEFAULT
|
* @throws MethodArgumentValueNotImplementedException If the $type is different than TYPE_DEFAULT
|
||||||
*/
|
*/
|
||||||
public function format($value, $type = self::TYPE_DEFAULT)
|
public function format($value, $type = self::TYPE_DEFAULT)
|
||||||
{
|
{
|
||||||
@ -404,19 +417,22 @@ class StubNumberFormatter
|
|||||||
/**
|
/**
|
||||||
* Returns the formatter's locale
|
* Returns the formatter's locale
|
||||||
*
|
*
|
||||||
* @param int $type The locale name type to return between valid or actual (StubLocale::VALID_LOCALE or StubLocale::ACTUAL_LOCALE, respectively)
|
* The parameter $type is currently ignored.
|
||||||
*
|
*
|
||||||
* @return string The locale name used to create the formatter
|
* @param int $type Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE)
|
||||||
|
*
|
||||||
|
* @return string The locale used to create the formatter. Currently always
|
||||||
|
* returns "en".
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/numberformatter.getlocale.php
|
* @see http://www.php.net/manual/en/numberformatter.getlocale.php
|
||||||
*/
|
*/
|
||||||
public function getLocale($type = StubLocale::ACTUAL_LOCALE)
|
public function getLocale($type = StubLocale::ACTUAL_LOCALE)
|
||||||
{
|
{
|
||||||
return $this->locale;
|
return 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the formatter's pattern
|
* Not supported. Returns the formatter's pattern
|
||||||
*
|
*
|
||||||
* @return Boolean|string The pattern string used by the formatter or false on error
|
* @return Boolean|string The pattern string used by the formatter or false on error
|
||||||
*
|
*
|
||||||
@ -430,7 +446,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a formatter symbol value
|
* Not supported. Returns a formatter symbol value
|
||||||
*
|
*
|
||||||
* @param int $attr A symbol specifier, one of the format symbol constants
|
* @param int $attr A symbol specifier, one of the format symbol constants
|
||||||
*
|
*
|
||||||
@ -446,7 +462,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a formatter text attribute value
|
* Not supported. Returns a formatter text attribute value
|
||||||
*
|
*
|
||||||
* @param int $attr An attribute specifier, one of the text attribute constants
|
* @param int $attr An attribute specifier, one of the text attribute constants
|
||||||
*
|
*
|
||||||
@ -462,7 +478,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a currency number
|
* Not supported. Parse a currency number
|
||||||
*
|
*
|
||||||
* @param string $value The value to parse
|
* @param string $value The value to parse
|
||||||
* @param string $currency Parameter to receive the currency name (reference)
|
* @param string $currency Parameter to receive the currency name (reference)
|
||||||
@ -483,8 +499,10 @@ class StubNumberFormatter
|
|||||||
* Parse a number
|
* Parse a number
|
||||||
*
|
*
|
||||||
* @param string $value The value to parse
|
* @param string $value The value to parse
|
||||||
* @param int $type Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default
|
* @param int $type Type of the formatting, one of the format type constants.
|
||||||
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
|
* The only currently supported types are NumberFormatter::TYPE_DOUBLE,
|
||||||
|
* NumberFormatter::TYPE_INT32 and NumberFormatter::TYPE_INT64.
|
||||||
|
* @param int $position Not supported. Offset to begin the parsing on return this value will hold the offset at which the parsing ended
|
||||||
*
|
*
|
||||||
* @return Boolean|string The parsed value of false on error
|
* @return Boolean|string The parsed value of false on error
|
||||||
*
|
*
|
||||||
@ -529,8 +547,12 @@ class StubNumberFormatter
|
|||||||
/**
|
/**
|
||||||
* Set an attribute
|
* Set an attribute
|
||||||
*
|
*
|
||||||
* @param int $attr An attribute specifier, one of the numeric attribute constants
|
* @param int $attr An attribute specifier, one of the numeric attribute constants.
|
||||||
* @param int $value The attribute value
|
* The only currently supported attributes are NumberFormatter::FRACTION_DIGITS,
|
||||||
|
* NumberFormatter::GROUPING_USED and NumberFormatter::ROUNDING_MODE.
|
||||||
|
* @param int $value The attribute value. The only currently supported rounding modes are
|
||||||
|
* NumberFormatter::ROUND_HALFEVEN, NumberFormatter::ROUND_HALFDOWN and
|
||||||
|
* NumberFormatter::ROUND_HALFUP.
|
||||||
*
|
*
|
||||||
* @return Boolean true on success or false on failure
|
* @return Boolean true on success or false on failure
|
||||||
*
|
*
|
||||||
@ -574,7 +596,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the formatter's pattern
|
* Not supported. Set the formatter's pattern
|
||||||
*
|
*
|
||||||
* @param string $pattern A pattern string in conformance with the ICU DecimalFormat documentation
|
* @param string $pattern A pattern string in conformance with the ICU DecimalFormat documentation
|
||||||
*
|
*
|
||||||
@ -591,7 +613,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the formatter's symbol
|
* Not supported. Set the formatter's symbol
|
||||||
*
|
*
|
||||||
* @param int $attr A symbol specifier, one of the format symbol constants
|
* @param int $attr A symbol specifier, one of the format symbol constants
|
||||||
* @param string $value The value for the symbol
|
* @param string $value The value for the symbol
|
||||||
@ -608,7 +630,7 @@ class StubNumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a text attribute
|
* Not supported. Set a text attribute
|
||||||
*
|
*
|
||||||
* @param int $attr An attribute specifier, one of the text attribute constants
|
* @param int $attr An attribute specifier, one of the text attribute constants
|
||||||
* @param int $value The attribute value
|
* @param int $value The attribute value
|
||||||
|
Reference in New Issue
Block a user