{@inheritdoc}
This generates a 3 by 7 by 7 digit number (much like amazon's order identifier)
e.g. 105-3958356-3707476
199610
protected function generateNumber($index, SequenceSubjectInterface $order)
    {
        do {
            $number = $this->generateSegment(3).'-'.$this->generateSegment(7).'-'.$this->generateSegment(7);
        } while ($this->subjectRepository->isNumberUsed($number));

        return $number;
    }
1286778
private byte[] number2BytesInNetworkOrder(int number) {
    byte[] orderBytes = new byte[4];
    orderBytes[3] = (byte) (number & 0xFF);
    orderBytes[2] = (byte) (number >> 8 & 0xFF);
    orderBytes[1] = (byte) (number >> 16 & 0xFF);
    orderBytes[0] = (byte) (number >> 24 & 0xFF);
    return orderBytes;
  }
92393
public static function size_varint($i) {
/*		$len = 0;
		do {
			$i = $i >> 7;
			$len++;
		} while ($i != 0);
		return $len;
*/
		// TODO Change to a binary search
		if ($i < 0x80)
			return 1;
		if ($i < 0x4000)
			return 2;
		if ($i < 0x200000)
			return 3;
		if ($i < 0x10000000)
			return 4;
		if ($i < 0x800000000)
			return 5;
		if ($i < 0x40000000000)
			return 6;
		if ($i < 0x2000000000000)
			return 7;
		if ($i < 0x100000000000000)
			return 8;
		if ($i < 0x8000000000000000)
			return 9;
	}
621016
public function to10($isbn)
    {
        if(is_string($isbn) === false) {
            throw new Exception('Invalid parameter type.');
        }

        if (strlen($isbn) > 13) {
            $isbn = substr($isbn, 4, -1);
        } else {
            $isbn = substr($isbn, 3, -1);
        }

        return $isbn.$this->checkDigit->make($isbn);
    }
1031150
public function ordinal(): string
    {
        $abs = abs($this->number);

        switch ($abs % 10) {
            case 1:
                $ordinal = ($abs % 100 === 11) ? 'th' : 'st';
                break;
            case 2:
                $ordinal = ($abs % 100 === 12) ? 'th' : 'nd';
                break;
            case 3:
                $ordinal = ($abs % 100 === 13) ? 'th' : 'rd';
                break;
            default:
                $ordinal = 'th';
                break;
        }

        return $ordinal;
    }
1326903
public function make10($isbn)
    {
        if(is_string($isbn) === false) {
            throw new Exception('Invalid parameter type.');
        }

        //Verify length
        $isbnLength = strlen($isbn);
        if ($isbnLength < 9 or $isbnLength > 10) {
            throw new Exception('Invalid ISBN-10 format.');
        }

        //Calculate check digit
        $check = 0;
        for ($i = 0; $i < 9; $i++) {
            if ($isbn[$i] === 'X') {
                $check += 10 * intval(10 - $i);
            } else {
                $check += intval($isbn[$i]) * intval(10 - $i);
            }
        }

        $check = 11 - $check % 11;
        if ($check === 10) {
            return 'X';
        } elseif ($check === 11) {
            return 0;
        }
        
        return $check;
    }
34333
public function getOrderNumber() : ?int 
    {
        if ( ! $this->hasOrderNumber()) {
            $this->setOrderNumber($this->getDefaultOrderNumber());
        }
        return $this->orderNumber;
    }
284842
protected function getNumberFormatter()
    {
        $formatter = new \NumberFormatter($this->locale, \NumberFormatter::DECIMAL);

        if (null !== $this->precision) {
            $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->precision);
            $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
        }

        $formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);

        return $formatter;
    }
685392
function it_matches_identifiers()
    {
        $this->match('123')->shouldReturn('123');
        $this->match('3.14')->shouldReturn('3.14');
        $this->match('-123')->shouldReturn('-123');
    }
1354221
public function attemptToFormatAccruedDigits()
    {
        foreach ($this->possibleFormats as $numberFormat) {
            $m = new Matcher($numberFormat->getPattern(), $this->nationalNumber);
            if ($m->matches()) {
                $nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparatorsPattern, $numberFormat->getNationalPrefixFormattingRule());
                $this->shouldAddSpaceAfterNationalPrefix = $nationalPrefixSeparatorsMatcher->find();
                $formattedNumber = $m->replaceAll($numberFormat->getFormat());
                return $this->appendNationalNumber($formattedNumber);
            }
        }
        return '';
    }
571619
public function getTrackingId()
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $charactersLength = strlen($characters);
        $trackingId = '';
        for ($i = 0; $i < 10; $i++) {
            $trackingId .= $characters[rand(0, $charactersLength - 1)];
        }
        return $trackingId;
    }
44730
public function parseNumber()
    {
        $tel = [
            'Original' => $this->value,
        ];

        // remove brackets
        $str = str_replace(['(', ')'], '', $this->value);

        // replace characters with space
        $str = trim(
            preg_replace('/\s+/', ' ', preg_replace('/[^a-z0-9\#\+]/i', ' ', strtolower($str)))
        );

        // try detect if number starts with a + or international dialing code
        if (preg_match('/^(\+\d{1,3}\b)/', $str, $matches)) {
            $tel['CountryCode'] = substr($matches[1], 1);
            $str = trim(substr($str, strlen($matches[0])));
        } elseif (preg_match('/^(00|010|011|0011|810|0010|0011|0014)\s?(\d{1,3})\b/', $str, $matches)) {
            $tel['CountryCode'] = $matches[2];
            $str = trim(substr($str, strlen($matches[0])));
        }

        // try detect if an extension is included
        if (preg_match('/(#|ext|extension)\s?(\d)+$/', $str, $matches)) {
            $tel['Extension'] = $matches[2];
            $str = trim(preg_replace('/' . preg_quote($matches[0], '/') . '$/', '', $str));
        }

        // set default country code if none detected
        if (empty($tel['CountryCode'])) {
            $tel['CountryCode'] = $this->config()->get('default_country_code');
        }

        // remove leading 0
        if (substr($str, 0, 1) == '0') {
            $str = trim(substr($str, 1));
        }

        // remaining number must contain at least 6 digits
        if (preg_match('/[a-z]/', $str) || preg_match_all('/\d/', $str) < 6) {
            return false;
        }

        // generate a RFC3966 link
        $tel['RFC3966'] = 'tel:+' . $tel['CountryCode'] . '-' . preg_replace('/[^0-9]/', '-', $str);
        if (!empty($tel['Extension'])) {
            $tel['RFC3966'] .= ';ext=' . $tel['Extension'];
        }

        return $tel;
    }
451288
public function number($number)
    {
        if ($number < 0) {
            $number   = -$number;
            $negative = self::NEGATIVE;
        } else {
            $negative = '';
        }
        $parts    = explode(self::DECIMAL, (string) $number, 2);
        $integers = $parts[0];
        if (strlen($integers) >= $this->digitsFirstGroup() + $this->minimumGroupingDigits()) {
            $todo     = substr($integers, 0, -$this->digitsFirstGroup());
            $integers = self::GROUP . substr($integers, -$this->digitsFirstGroup());
            while (strlen($todo) >= $this->digitsGroup() + $this->minimumGroupingDigits()) {
                $integers = self::GROUP . substr($todo, -$this->digitsGroup()) . $integers;
                $todo     = substr($todo, 0, -$this->digitsGroup());
            }
            $integers = $todo . $integers;
        }
        if (count($parts) > 1) {
            $decimals = self::DECIMAL . $parts[1];
        } else {
            $decimals = '';
        }

        return $this->digits($negative . $integers . $decimals);
    }
883864
public static function ordinalize($number)
    {
        if (in_array(($number % 100), range(11, 13))) {
            return $number . 'th';
        }
        switch ($number % 10) {
            case 1:
                return $number . 'st';
            case 2:
                return $number . 'nd';
            case 3:
                return $number . 'rd';
            default:
                return $number . 'th';
        }
    }
976905
protected function gerarNossoNumero()
    {
        return Util::numberFormatGeral($this->getNumero(), 11)
            . CalculoDV::bradescoNossoNumero($this->getCarteira(), $this->getNumero());
    }
823488
private function attemptToChooseFormattingPattern()
    {
        // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        // number (excluding national prefix) have been entered.
        if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
            $this->getAvailableFormats($this->nationalNumber);
            // See if the accrued digits can be formatted properly already.
            $formattedNumber = $this->attemptToFormatAccruedDigits();
            if (mb_strlen($formattedNumber) > 0) {
                return $formattedNumber;
            }
            return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
        }

        return $this->appendNationalNumber($this->nationalNumber);
    }
378563
public function get10()
    {
        // Is it valid?
        if ($this->isValid()) {
            // Is it already an ISBN-10?  If so, return as-is.
            if (strlen($this->raw) == 10) {
                return $this->raw;
            } elseif (strlen($this->raw) == 13
                && substr($this->raw, 0, 3) == '978'
            ) {
                // Is it a Bookland EAN?  If so, we can convert to ISBN-10.
                $start = substr($this->raw, 3, 9);
                return $start . self::getISBN10CheckDigit($start);
            }
        }

        // If we made it this far, conversion was not possible:
        return false;
    }