Inpsyde\MultilingualPress\Common\Type\Language::name PHP Method

name() public method

Returns the language name (or code) according to the given argument.
Since: 3.0.0
public name ( string $output = 'native' ) : string
$output string Optional. Output type. Defaults to 'native'.
return string Language name (or code) according to the given argument.
    public function name($output = 'native');

Usage Example

 /**
  * @param Language $language
  * @param array    $user
  * @return float The user priority
  */
 private function get_user_priority(Language $language, array $user)
 {
     $lang_http = strtolower($language->name('http_name'));
     if (isset($user[$lang_http])) {
         return $user[$lang_http];
     }
     $lang_short = strtolower($language->name('language_short'));
     if (isset($user[$lang_short])) {
         return $this->language_only_priority_factor * $user[$lang_short];
     }
     return 0;
 }