Add importers in console and admin for flights/aircraft/subfleets and airport #194
This commit is contained in:
@@ -19,4 +19,31 @@ class FlightType extends Enum
|
||||
FlightType::CARGO => 'Cargo',
|
||||
FlightType::CHARTER => 'Charter',
|
||||
];
|
||||
|
||||
/**
|
||||
* Return value from P, C or H
|
||||
* @param $code
|
||||
* @return int
|
||||
*/
|
||||
public static function getFromCode($code): int
|
||||
{
|
||||
if(is_numeric($code)) {
|
||||
return (int) $code;
|
||||
}
|
||||
|
||||
$code = strtolower($code);
|
||||
if($code === 'p') {
|
||||
return self::PASSENGER;
|
||||
}
|
||||
|
||||
if ($code === 'c') {
|
||||
return self::CARGO;
|
||||
}
|
||||
|
||||
if($code === 'h') {
|
||||
return self::CHARTER;
|
||||
}
|
||||
|
||||
return self::PASSENGER;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user