1 | <?php |
||
13 | class Country extends Model |
||
14 | { |
||
15 | /** |
||
16 | * The name of the country |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $name; |
||
20 | |||
21 | /** |
||
22 | * The ISO code of the country |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $iso; |
||
26 | |||
27 | /** |
||
28 | * The name of the database table used for queries |
||
29 | */ |
||
30 | const TABLE = "countries"; |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 1 | protected function assignResult($country) |
|
40 | |||
41 | /** |
||
42 | * Get the name of the country in the default language |
||
43 | * |
||
44 | * @return string The name of the country |
||
45 | */ |
||
46 | 1 | public function getName() |
|
50 | |||
51 | /** |
||
52 | * Get the ISO code of a country |
||
53 | * |
||
54 | * @return string The ISO code of the country |
||
55 | */ |
||
56 | 1 | public function getISO() |
|
60 | |||
61 | /** |
||
62 | * Get the HTML to display a specific flag |
||
63 | * |
||
64 | * @return string HTML to generate a flag |
||
65 | */ |
||
66 | 1 | public function getFlagLiteral() |
|
70 | |||
71 | /** |
||
72 | * Get all the countries in the database |
||
73 | * |
||
74 | * @return Country[] An array of country objects |
||
75 | */ |
||
76 | public static function getCountries() |
||
80 | |||
81 | /** |
||
82 | * Get an associative array with country ISO code as keys and country names |
||
83 | * as values |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | public static function getCountriesWithISO() |
||
95 | |||
96 | /** |
||
97 | * Get the country's flag's CSS class |
||
98 | * |
||
99 | * @return string The URL to the country's flag |
||
100 | */ |
||
101 | 1 | private function getFlagCssClass() |
|
105 | |||
106 | /** |
||
107 | * Given a country's ISO, get its ID |
||
108 | * |
||
109 | * @param string $iso The two-letter ISO code of the country |
||
110 | * @return int The country's database ID |
||
111 | */ |
||
112 | public static function getIdFromISO($iso) |
||
116 | |||
117 | /** |
||
118 | * Get a query builder for countries |
||
119 | * |
||
120 | * @return QueryBuilder |
||
121 | */ |
||
122 | public static function getQueryBuilder() |
||
131 | } |
||
132 |