Hydrate borders.

@param $country
@return mixed
481903
public function hydrateBorders($country)
    {
        $country['borders'] = isset($country['borders'])
            ? $country['borders'] = countriesCollect($country['borders'])->map(function ($border) {
                return $this->repository->call('where', ['cca3', $border])->first();
            })
            : countriesCollect();

        return $country;
    }
963894
public function getList($country)
    {
        $list = Region::get()
            ->filter("CountryCode", strtoupper($country));

        if (!$list->exists() && $this->getCreateEmptyDefault()) {
            $countries = i18n::getData()->getCountries();
            if (isset($countries[strtolower($country)])) {
                $name = $countries[strtolower($country)];
            } else {
                $name = $country;
            }
            $list = ArrayList::create();
            $list->push(Region::create([
                "Name" => $name,
                "Type" => "Nation",
                "Code" => strtoupper($country),
                "CountryCode" => strtoupper($country)
            ]));
        }

        return $list;
    }
84005
public function hydrate($target, $elements = null)
    {
        $elements = $this->getHydrationElements($elements);

        if (coollect($elements)->count() === 0) {
            return $target;
        }

        return $this->isCountry($target->toArray())
            ? $this->hydrateCountry($target, $elements)
            : $this->hydrateCountries($target, $elements);
    }
564362
public static function hydrate(stdClass $sink)
    {
        $hydrated = new SinkEntity();

        if (isset($sink->id)) {
            $hydrated->setId($sink->id);
        }

        if (isset($sink->line)) {
            $hydrated->setLine($sink->line);
        }

        if (isset($sink->start_line)) {
            $hydrated->setStartLine($sink->start_line);
        }

        if (isset($sink->end_line)) {
            $hydrated->setEndLine($sink->end_line);
        }

        if (isset($sink->name)) {
            $hydrated->setName($sink->name);
        }

        if (isset($sink->file)) {
            $hydrated->setFile(FileHydrator::hydrate($sink->file));
        }

        if (isset($sink->function)) {
            $hydrated->setFunction(CustomFunctionHydrator::hydrate($sink->function));
        }

        if (isset($sink->class)) {
            $hydrated->setClass(CustomClassHydrator::hydrate($sink->class));
        }

        if (isset($sink->start_column)) {
            $hydrated->setStartColumn($sink->start_column);
        }

        if (isset($sink->end_column)) {
            $hydrated->setEndColumn($sink->end_column);
        }

        if (isset($sink->type)) {
            $hydrated->setType(TypeHydrator::hydrate($sink->type));
        }

        if (isset($sink->taint)) {
            $hydrated->setTaint(TaintHydrator::hydrate($sink->taint));
        }

        return $hydrated;
    }
167722
public function getCountryCode($country = null)
    {
        if ($country === null) {
            $country = $this->_country;
        }

        $code = KlarnaCountry::getCode($country);
        return (string) $code;
    }
523281
public function selectCountry($country)
    {
        if (!isset($this->_issuerData)) {
            $this->_country = $this->validateCountry($country);
            return $this;
        }

        if (in_array($country, $this->getCountries())) {
            $this->_country = $this->validateCountry($country);
            return $this;
        };

        if (in_array("00", $this->getCountries())) {
            $this->_country = "00";
        };

        return $this;
    }
328190
public function ValidTax($country = null, $region = null)
    {
        if (empty($country)) {
            // First try and get the locale from the member
            $member = Security::getCurrentUser();

            if ($member && $member->getLocale()) {
                $country = $member->getLocale();
            }
        }

        if (empty($country)) {
            $country = i18n::get_locale();
        }

        if (strlen($country) > 2) {
            $country = Locale::getRegion($country);
        }

        $filter = [
            'Global' => 1,
            "Zones.Regions.CountryCode" => $country
        ];

        $rates = $this
            ->Rates()
            ->filterAny($filter);

        if (isset($region)) {
            $rates = $rates->filter("Zones.Regions.Code", $region);
        }

        return $rates->first();
    }
577720
public static function calculateDynamicParts($country) {
    $dynamic_parts = [];
    $addressFormatRepository = \Drupal::service('address.address_format_repository');
    $address_format = $addressFormatRepository->get($country);
    $subdivisionRepository = \Drupal::service('address.subdivision_repository');
    $options = $subdivisionRepository->getList([$country]);
    $labels = LabelHelper::getFieldLabels($address_format);

    // Update region options based on country.
    $dynamic_parts['region']['#options'] = $options;
    $dynamic_parts['region']['#required'] = TRUE;
    $dynamic_parts['region']['#access'] = TRUE;

    // Update labels.
    $cityLabel = $labels['locality'];
    $postcodeLabel = $labels['postalCode'];
    $regionLabel = $labels['administrativeArea'];
    $dynamic_parts['region']['#title'] = $regionLabel;
    $dynamic_parts['postcode']['#title'] = $postcodeLabel;
    $dynamic_parts['city']['#title'] = $cityLabel;

    if (empty($cityLabel)) {
      $dynamic_parts['city']['#required'] = FALSE;
      $dynamic_parts['city']['#access'] = FALSE;
    }

    if (empty($postcodeLabel)) {
      $dynamic_parts['postcode']['#required'] = FALSE;
      $dynamic_parts['postcode']['#access'] = FALSE;
    }

    if (empty($regionLabel) || empty($options)) {
      $dynamic_parts['region']['#required'] = FALSE;
      $dynamic_parts['region']['#access'] = FALSE;
    }

    return $dynamic_parts;
  }
1230921
protected function hydrateObjectForm($object)
    {
        $data = array(
            'id' => $object->getId(),
            'locale' => $object->getLocale(),
            'visible' => $object->getVisible() ? true : false,
            'country_id' => $object->getCountryId(),
            'title' => $object->getTitle(),
            'isocode' => $object->getIsocode(),
        );

        return $this->createForm(AdminForm::STATE_MODIFICATION, 'form', $data);
    }
1301473
public function hydrate($value)
    {
        $metaData = $this->metaData;
        $managers = [];

        if ('__empty__' == $value) {
            unset($metaData['organizations:managers']);
        } else {
            foreach ($value as $manager) {
                list($id, $name, $email) = explode('|', $manager, 3);
                $managers[] = [
                    'id' => $id,
                    'name' => $name,
                    'email' => $email,
                ];
            }
            $metaData['organizations:managers'] = $managers;
        }

        return $metaData;
    }
1196118
public function border($char = null, $length = null)
    {
        return $this->climate->border($char, $length);
    }
135665
public function callFrom(string $country) : string
    {
        return $this->util->formatOutOfCountryCallingNumber($this->number, $country);
    }
437380
public function refreshCountry(Country $country)
    {

        $refreshedCountry = $this->findCountryBy(array('id' => $country->getId()));
        if (null === $refreshedCountry) {
            throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $country->getId()));
        }
        return $refreshedCountry;
    }
8027
public function removeCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country)
    {
        return $this->country->removeElement($country);
    }
1216649
public static function hydrate(stdClass $concat)
    {
        $hydrated = new ConcatEntity();

        if (isset($concat->id)) {
            $hydrated->setId($concat->id);
        }

        if (isset($concat->line)) {
            $hydrated->setLine($concat->line);
        }

        if (isset($concat->start_line)) {
            $hydrated->setStartLine($concat->start_line);
        }

        if (isset($concat->end_line)) {
            $hydrated->setEndLine($concat->end_line);
        }

        if (isset($concat->file)) {
            $hydrated->setFile(FileHydrator::hydrate($concat->file));
        }

        if (isset($concat->function)) {
            $hydrated->setFunction(CustomFunctionHydrator::hydrate($concat->function));
        }

        if (isset($concat->class)) {
            $hydrated->setClass(CustomClassHydrator::hydrate($concat->class));
        }

        if (isset($concat->start_column)) {
            $hydrated->setStartColumn($concat->start_column);
        }

        if (isset($concat->end_column)) {
            $hydrated->setEndColumn($concat->end_column);
        }

        if (isset($concat->taint)) {
            $hydrated->setTaint(TaintHydrator::hydrate($concat->taint));
        }

        return $hydrated;
    }
201619
public function findByCountry($country)
    {
        $country = Text::toUpper($country);
        foreach ($this->getAvailable() as $locale) {
            if ($country == $locale->getCountry(Text::UPPER)) {
                return $locale;
            }
        }

        return null;
    }
1215273
public function setCountry($country)
    {
        if (!is_string($country) && !is_null($country)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not a string');
        }

        $this->country = $country;

        return $this;
    }