Antidot PHP API  version 0.16.0
##PHP API to simplify integration of Antidot components
 All Classes Files Functions Variables Groups Pages
Public Member Functions | Public Attributes | List of all members
AfsLanguage Class Reference

Language class. More...

Public Member Functions

 __construct ($lang_str)
 Construct AFS language object from string.
 get_string ()
 String representation of an instance.
 __toString ()
 String representation of an instance.

Public Attributes

 $lang = null
 Language code in lower case (iso639-1 code)
 $country = null
 Country code in lower case (iso3166-1 code)

Detailed Description

Language class.

This class simplify language management by providing:

Constructor & Destructor Documentation

__construct (   $lang_str)

Construct AFS language object from string.

Language should be composed of two ASCII characters representing language code from iso639-1 standard followed by hyphen (or for convenience by underscore) followed by two characters representing country code from iso3166-1 standard.

  • Example of valid inputs:
    • en
    • en-US
    • EN-GB
    • en_gb (for convenience).
  • Example of invalid inputs:
    • english
    • en-USA
Remarks
Even if language code XX is invalid, it will not be considered as invalid since it is composed of two letters.
Parameters
$lang_str[in] language and country code as string parameter.
Exceptions
InvalidArgumentExceptionwhen provided lang_str is invalid.

Member Function Documentation

__toString ( )

String representation of an instance.

Returns
see get_string for more details.
get_string ( )

String representation of an instance.

Returns
lower case string composed by language code (iso639-1) and country code (iso3166-1) separated by hyphen. Empty string is returned when no language code has been set.