| Total Complexity | 8 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class HistoricCountries extends AbstractDatabase |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return string |
||
| 12 | */ |
||
| 13 | public static function getISONumber() |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param array $entry |
||
| 20 | * |
||
| 21 | * @return Country |
||
| 22 | */ |
||
| 23 | protected function arrayToEntry(array $entry) |
||
| 24 | { |
||
| 25 | return new Country( |
||
| 26 | $entry['name'], |
||
| 27 | $entry['alpha_4'], |
||
| 28 | $entry['alpha_3'], |
||
| 29 | $entry['alpha_2'], |
||
| 30 | $entry['withdrawal_date'], |
||
| 31 | !empty($entry['numeric']) ? (int)$entry['numeric'] : null |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | protected function getIndexDefinition() |
||
| 39 | { |
||
| 40 | return [ |
||
| 41 | 'alpha_4', |
||
| 42 | 'alpha_3', |
||
| 43 | 'alpha_2', |
||
| 44 | 'numeric' |
||
| 45 | ]; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $code |
||
| 50 | * |
||
| 51 | * @return null|Country |
||
| 52 | */ |
||
| 53 | public function getByAlpha4($code) |
||
| 54 | { |
||
| 55 | return $this->find('alpha_4', $code); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param string $code |
||
| 60 | * |
||
| 61 | * @return null|Country |
||
| 62 | */ |
||
| 63 | public function getByAlpha3($code) |
||
| 64 | { |
||
| 65 | return $this->find('alpha_3', $code); |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param string $code |
||
| 70 | * |
||
| 71 | * @return null|Country |
||
| 72 | */ |
||
| 73 | public function getByAlpha2($code) |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @param int $code |
||
| 80 | * |
||
| 81 | * @return null|Country |
||
| 82 | */ |
||
| 83 | public function getByNumericCode($code) |
||
| 86 | } |
||
| 87 | } |
||
| 88 |