/** * @param $type * @return mixed */ public static function get_type($type) { if (!isset(self::$all_rows)) { self::$all_rows = flight_type::get_all([]); } foreach (self::$all_rows as $flight_type) { if ($flight_type->ftid == $type) { return $flight_type->title; } } return ''; }
static function flight_type($int) { if (!isset(self::$flight_type)) { $types = flight_type::get_all(['ftid', 'title']); $types->iterate(function (flight_type $type) { self::$flight_type[$type->ftid] = $type->title; }); } if (isset(self::$flight_type[$int])) { return self::$flight_type[$int]; } return false; }