/** * @param Country $country * @return null|mixed */ public static function translateCountry(Country $country) { $name = $country->setLocale("en_US")->getTitle(); $name = str_replace(" ", "_", strtoupper($name)); return defined($const = "Predict\\Export\\CountryEnum::" . $name) ? constant($const) : null; }