Punic APIs
  • Namespace
  • Class
  • Tree
  • Todo

Namespaces

  • Punic
    • Exception

Classes

  • Calendar
  • Comparer
  • Currency
  • Data
  • Language
  • Misc
  • Number
  • Phone
  • Plural
  • Territory
  • Unit

Exceptions

  • Exception

Class Misc

Various helper stuff.

Namespace: Punic
Located at Misc.php

Methods summary

public static string
# joinAnd( array|Traversable $list, string $width = '', string $locale = '' )

Concatenates a list of items returning a localized string using "and" as seperator.

Concatenates a list of items returning a localized string using "and" as seperator.

For instance, array(1, 2, 3) will result in '1, 2, and 3' for English or '1, 2 e 3' for Italian.

Parameters

$list
The list to concatenate
$width
The preferred width ('' for default, or 'short' or 'narrow')
$locale
The locale to use. If empty we'll use the default locale set in \Punic\Data

Returns

string
returns an empty string if $list is not an array of it it's empty, the joined items otherwise
public static string
# joinOr( array|Traversable $list, string $width = '', string $locale = '' )

Concatenates a list of items returning a localized string using "or" as seperator.

Concatenates a list of items returning a localized string using "or" as seperator.

For instance, array(1, 2, 3) will result in '1, 2, or 3' for English or '1, 2 o 3' for Italian.

Parameters

$list
The list to concatenate
$width
The preferred width ('' for default, or 'short' or 'narrow')
$locale
The locale to use. If empty we'll use the default locale set in \Punic\Data

Returns

string
returns an empty string if $list is not an array of it it's empty, the joined items otherwise
public static string
# joinUnits( array|Traversable $list, string $width = '', string $locale = '' )

Concatenates a list of unit items returning a localized string.

Concatenates a list of unit items returning a localized string.

For instance, array('3 ft', '2 in') will result in '3 ft, 2 in'.

Parameters

$list
The list to concatenate
$width
The preferred width ('' for default, or 'short' or 'narrow')
$locale
The locale to use. If empty we'll use the default locale set in \Punic\Data

Returns

string
returns an empty string if $list is not an array of it it's empty, the joined items otherwise
public static string
# fixCase( string $string, string $case )

Fix the case of a string.

Fix the case of a string.

Parameters

$string
The string whose case needs to be fixed
$case

How to fix case. Allowed values:

  • 'titlecase-words' all words in the phrase should be title case
  • 'titlecase-firstword' the first word should be title case
  • 'lowercase-words' all words in the phrase should be lower case
  • Returns

    string

    See

    http://cldr.unicode.org/development/development-process/design-proposals/consistent-casing
    public static array
    # getBrowserLocales( boolean $ignoreCache = false )

    Parse the browser HTTP_ACCEPT_LANGUAGE header and return the found locales, sorted in descending order by the quality values.

    Parse the browser HTTP_ACCEPT_LANGUAGE header and return the found locales, sorted in descending order by the quality values.

    Parameters

    $ignoreCache
    Set to true if you want to ignore the cache

    Returns

    array
    Array keys are the found locales, array values are the relative quality value (from 0 to 1)
    public static array
    # parseHttpAcceptLanguage( string $httpAcceptLanguages )

    Parse the value of an HTTP_ACCEPT_LANGUAGE header and return the found locales, sorted in descending order by the quality values.

    Parse the value of an HTTP_ACCEPT_LANGUAGE header and return the found locales, sorted in descending order by the quality values.

    Parameters

    $httpAcceptLanguages

    Returns

    array
    Array keys are the found locales, array values are the relative quality value (from 0 to 1)
    public static string
    # getCharacterOrder( string $locale = '' )

    Retrieve the character order (right-to-left or left-to-right).

    Retrieve the character order (right-to-left or left-to-right).

    Parameters

    $locale
    The locale to use. If empty we'll use the default locale set in \Punic\Data

    Returns

    string
    Return 'left-to-right' or 'right-to-left'
    public static string
    # getLineOrder( string $locale = '' )

    Retrieve the line order (top-to-bottom or bottom-to-top).

    Retrieve the line order (top-to-bottom or bottom-to-top).

    Parameters

    $locale
    The locale to use. If empty we'll use the default locale set in \Punic\Data

    Returns

    string
    Return 'top-to-bottom' or 'bottom-to-top'
    public static string
    # join( array|Traversable $list, string $locale = '' )

    Deprecated

    use joinAnd($list, '', $locale)

    Parameters

    $list
    $locale

    Returns

    string
    Punic APIs API documentation generated by ApiGen