@@ -244,8 +244,8 @@ public function __toString()
244
244
$ labelLocale = $ this ->getLabelInCurrentLocale () ? $ locale : $ current ;
245
245
246
246
$ url = $ this ->getView ()->localeUrl ($ locale );
247
- $ title = $ this ->callLocale ($ this ->getTitleMethod (), $ locale , $ titleLocale );
248
- $ label = $ this ->callLocale ($ this ->getLabelMethod (), $ locale , $ labelLocale );
247
+ $ title = $ this ->getLocaleProperty ($ this ->getTitleMethod (), $ locale , $ titleLocale );
248
+ $ label = $ this ->getLocaleProperty ($ this ->getLabelMethod (), $ locale , $ labelLocale );
249
249
250
250
$ item = sprintf (
251
251
'<li><a href="%s" title="%s"%s>%s</a></li> ' . "\n" ,
@@ -297,16 +297,24 @@ protected function checkLocaleMethod($method)
297
297
}
298
298
}
299
299
300
- protected function callLocale ($ method , $ locale , $ in_locale = false )
300
+ /**
301
+ * Retrieves a value by property from Locale
302
+ *
303
+ * @param $property
304
+ * @param $locale
305
+ * @param bool $in_locale
306
+ * @return mixed
307
+ */
308
+ protected function getLocaleProperty ($ property , $ locale , $ in_locale = false )
301
309
{
302
- $ method = sprintf ('\Locale::get%s ' , ucfirst ($ method ));
310
+ $ callback = sprintf ('\Locale::get%s ' , ucfirst ($ property ));
303
311
304
312
$ args = array ($ locale );
305
313
306
- if ($ in_locale && !in_array ($ method , array ('primaryLanguage ' , 'region ' , 'script ' ))) {
314
+ if ($ in_locale && !in_array ($ property , array ('primaryLanguage ' , 'region ' , 'script ' ))) {
307
315
$ args [] = $ in_locale ;
308
316
}
309
317
310
- return call_user_func_array ($ method , $ args );
318
+ return call_user_func_array ($ callback , $ args );
311
319
}
312
320
}
0 commit comments