| 1 | <?php |
||
| 15 | class Language { |
||
| 16 | /** |
||
| 17 | * ISO 639-1 standard two-letter language code. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public $code; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Two-letter flag code of the language. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | public $flag; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * List of language titles on different languages. |
||
| 32 | * |
||
| 33 | * @var array<string, string> |
||
| 34 | */ |
||
| 35 | public $titles = []; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Inits Language object. |
||
| 39 | * |
||
| 40 | * @param string $code Code of the language. |
||
| 41 | * @param array $titles List of languages titles on this language. |
||
| 42 | * @param string $flag Flag file name. |
||
| 43 | */ |
||
| 44 | public function __construct($code, $titles, $flag = "") { |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Returns title of the language by it's ISO code. |
||
| 52 | * If code is not set then returns native title of the language. |
||
| 53 | * |
||
| 54 | * @param string $code 2-letters language ISO code (optional). |
||
| 55 | * |
||
| 56 | * @return string Title of the language. |
||
| 57 | * @throws Exception If language code is incorrect. |
||
| 58 | */ |
||
| 59 | public function getTitle($code = null) { |
||
| 70 | |||
| 71 | } |
||
| 72 |