@param string $format The format to display the Country name (alpha2,
alpha3 or numeric)


@return CountryCode A CountryCode object.
430347
public function getCode($format)
    {
        foreach ($this->codes as $code) {
            if ($code->getFormat() == $format) {
                return $code;
            }
        }
    }
31441
public function format($format = '')
  {
    if ( !empty($format) ){
      return $this->time->format($format);
    }
    else { 
      return $this->time->format('Y-m-d H:i:s');
    }
  }
955437
public function format(Location $location, string $format): string
    {
        $countryName = null;
        $code = null;
        if (null !== $country = $location->getCountry()) {
            $countryName = $country->getName();
            if (null !== $code = $country->getCode()) {
                $code = strtoupper($code);
            }
        }

        $replace = [
            self::STREET_NUMBER => $location->getStreetNumber(),
            self::STREET_NAME => $location->getStreetName(),
            self::LOCALITY => $location->getLocality(),
            self::POSTAL_CODE => $location->getPostalCode(),
            self::SUB_LOCALITY => $location->getSubLocality(),
            self::COUNTRY => $countryName,
            self::COUNTRY_CODE => $code,
            self::TIMEZONE => $location->getTimezone(),
        ];

        for ($level = 1; $level <= AdminLevelCollection::MAX_LEVEL_DEPTH; ++$level) {
            $replace[self::ADMIN_LEVEL.$level] = null;
            $replace[self::ADMIN_LEVEL_CODE.$level] = null;
        }

        foreach ($location->getAdminLevels() as $level => $adminLevel) {
            $replace[self::ADMIN_LEVEL.$level] = $adminLevel->getName();
            $replace[self::ADMIN_LEVEL_CODE.$level] = $adminLevel->getCode();
        }

        return strtr($format, $replace);
    }
29746
public function format($format)
    {
        // Sprintf and unit regex
        $pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])([ ]*)(.*)/';

        // Check if string has sprintf and unit...
        if (preg_match_all($pattern, $format, $m)) {
            $sprintf = $m[1][0];
            $space   = $m[2][0];
            $units   = $m[3][0];

            $velocity = $this->units($units);

            // Should just display as scientific notation?
            if (sprintf($sprintf, $velocity) == 0 || $velocity > 10e9) {
                // Change sprintf to use e for scientific notation
                $sprintf = preg_replace('/[bcdeEufFgGosxX]/', 'e', $sprintf);
            }

            // Return format
            return sprintf($sprintf, $velocity) . $space . $units;
        }
    }
996501
public function format(int $format) : string
    {
        return PhoneNumberUtil::getInstance()->format($this->phoneNumber, $format);
    }
1350928
public function setFormat($format)
    {
        if($format)
        {
            if(!isset(static::$_formats[$format])) {
                throw new UnexpectedValueException('Unregistered format: "' . $format . '" given.');
            }

            $this->setContentType(static::$_formats[$format][0]);
        }

        return $this;
    }
1198378
public function setFormat(string $format = \null)
    {
        $validValues = ['png', 'jpg', 'webp'];

        if (\null !== $format && !\in_array($format, $validValues, \true)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unknown format "%s" given. Expected "%s" or null.',
                $format,
                \implode(', ', $validValues)
            ));
        }

        $this->format = $format;

        return $this;
    }
528019
public static function createFromString($locale, $format = self::UNDERSCORE)
    {
        $delimiter = '-';
        if (in_array($format, [self::UNDERSCORE, self::LCID])) {
            $delimiter = '_';
        }

        $parts = explode($delimiter, $locale);

        $localization = new self();
        $localization->setLanguage(strtolower($parts[0]));
        if (count($parts) > 1) {
            $localization->setCountry(strtolower($parts[1]));
        }

        return $localization;
    }
1022919
public function formatForMobileDialingInCountry($country, $removeFormatting = false)
    {
        if (! static::isValidCountryCode($country)) {
            throw CountryCodeException::invalid($country);
        }

        return $this->lib->formatNumberForMobileDialing(
            $this->getPhoneNumberInstance(),
            $country,
            $removeFormatting
        );
    }
1296013
protected static function parseFormat($format)
    {
        static::loadFormats();

        // If the format equals a constant's value, just return it.
        if (in_array($format, static::$formats, true)) {
            return $format;
        }

        // Otherwise we'll assume the format is the constant's name.
        return Arr::get(static::$formats, strtoupper($format));
    }
171556
public static function getFormatClass($format)
    {
        // Return a namespace in a given format
        $class = sprintf('%s\Format\%sFormat', __NAMESPACE__, ucfirst(strtolower($format)));

        if (!class_exists($class)) {
            throw new \DomainException(
                sprintf(
                    'Structure format: %s not supported. Class: %s not found.',
                    $format,
                    $class
                )
            );
        }

        return $class;
    }
836431
public function format($format)
    {
        // Sprintf and unit regex
        $pattern = '/(%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])(.*)/';

        // Check if string has sprintf and unit...
        if (preg_match_all($pattern, $format, $m)) {
            // Valid format, save to instance.
            $this->format = $format;

            // Get sprintf and units
            $sprintf = $m[1][0];
            $unit    = $m[2][0];

            // Try to find value of instance at specified units.
            $value = $this->{trim($unit)};
            if ($value == 0) {
                $value = $this->{strtolower(trim($unit))};
                if ($value == 0) {
                    $value = $this->{strtoupper(trim($unit))};
                }
            }

            // Should just display as scientific notation?
            if (sprintf($sprintf, $value) == 0 || $value > 10e9) {
                // Change sprintf to use e for scientific notation
                $sprintf = preg_replace('/[bcdeEufFgGosxX]/', 'e', $sprintf);
            }

            // Return value with format and unit suffix.
            return sprintf($sprintf, $value) . $unit;
        } else {
            // No valid format found, use old format.
            if (preg_match_all($pattern, $this->format, $m)) {
                return $this->format(
                  str_replace(trim($m[2][0]), '', $m[0][0]) . $format);
            }
        }
    }
759755
public function getFormatMimeType($format)
    {
        $format = $this->normalizeFormat($format);
        $result = '';
        switch ($format) {
            case static::FORMAT_PNG:
            case static::FORMAT_JPEG:
            case static::FORMAT_GIF:
            case static::FORMAT_XBM:
                $result = 'image/' . $format;
                break;
            case static::FORMAT_WBMP:
                $result = 'image/vnd.wap.wbmp';
                break;
        }

        return $result;
    }
453224
public function setApiQueryStringRequestFormat($format)
    {
        $this->apiQueryStringRequestFormat = $format;
        return $this->apiQueryStringRequestFormat === $format ? true : false;
    }
396598
public function format($format = self::FORMAT_COMPLETE)
    {
        if (!$this->hasValidFormat()) {
            return false;
        }
        switch ($format) {
            case static::FORMAT_COMPLETE:
                return $this->join(
                    number_format($this->number, 0, null, "."),
                    $this->vn
                );
                break;

            case static::FORMAT_WITH_DASH:
                return $this->join($this->number, $this->vn);
                break;
        }
        return $this->number . $this->vn;
    }
1319715
public function format($format = null)
    {
        $format ?: $format = $this->format;

        return strtr($format, $this->getFormattedReplacements());
    }
444117
public function format(string $format = null, int $precision = null)
    {
        if (null === $format) {
            return Formatter::getIntelligentFormat($this->microsecond, $precision);
        }

        $unit = Mapper::getUnitFromAbbreviation($format);
        $value = $this->microsecond / Mapper::getFactor($unit);

        return Formatter::valueAndUnitToString($value, $unit, $precision);
    }