Example #1
0
 /**
  *
  */
 private function getRandomCountryInfo($type = NULL)
 {
     include_once DRUPAL_ROOT . '/includes/locale.inc';
     $manager = new CountryManager($this->getModuleHandler());
     $countries = $manager->getList();
     uksort($countries, function () {
         return rand() > rand();
     });
     $country = array_slice($countries, 0, 1);
     $value = array('code' => key($country), 'name' => reset($country));
     if (is_null($type)) {
         return $value;
     }
     return isset($value[$type]) ? $value[$type] : $value;
 }