Returns an appropriate type of digit list based on the parameter.
@param int|string|array $digitList List of digits
@return IntegerDigitList|StringDigitList|ArrayDigitList The built digit list
439371
private function buildDigitList($digitList)
    {
        if (is_int($digitList)) {
            return new IntegerDigitList($digitList);
        } elseif (is_string($digitList)) {
            return new StringDigitList($digitList);
        } elseif (is_array($digitList)) {
            return new ArrayDigitList($digitList);
        }

        throw new \InvalidArgumentException('Unexpected number base type');
    }
167950
public static function getNormalized(array $bitList)
    {
        $bitListNormalized = [];
        foreach ($bitList as $bitRow) {
            $matches = [];
            preg_match('/^(?<first>[\d]+)(-(?<second>[\d]+))?$/', (string)$bitRow, $matches);
            if (empty($matches)) {
                throw new WrongBitMappingRule("Incorrect Bit syntax: '{$bitRow}'");
            }

            if (!isset($matches['second'])) {
                if (isset($bitListNormalized[$matches['first']])) {
                    throw new WrongBitMappingRule('You can`t add "-" after number.');
                }
                $bitListNormalized[$matches['first']] = (int)$matches['first'];
                continue;
            }

            if ($matches['first'] > $matches['second']) {
                throw new WrongBitMappingRule("Start bit zone should be greater than end. But got: {$matches['first']} - {$matches['second']}");
            }
            if (!is_numeric($matches['first']) || !is_numeric($matches['second'])) {
                throw new WrongBitMappingRule("Start and end of zone should be numbers, but got: {$matches['first']} - {$matches['second']}");
            }

            for ($i = (int)$matches['first'], $end = $matches['second']; $i <= $end; $i++) {
                if (isset($bitListNormalized[$i])) {
                    throw new WrongBitMappingRule("Bit {$bitListNormalized[$i]} used more than once");
                }
                $bitListNormalized[$i] = $i; // Bits started from 1, but in array we start working with 0
            }
        }

        return array_values($bitListNormalized);
    }
694557
function(digit) {
			var obj = this.createList(digit, {
				classes: {
					active: this.factory.classes.active,
					before: this.factory.classes.before,
					flip: this.factory.classes.flip
				}
			});

			this.appendDigitToClock(obj);
		}
1188952
protected function evaluateInput($digit)
    {
        if ($this->inputIsCancel($digit)) {
            return self::INPUT_CANCEL;
        }
        if ($this->inputIsEnd($digit)) {
            return self::INPUT_END;
        }
        return self::INPUT_NORMAL;
    }
297643
public String getDecimalPart(final int digit) {
        
        final int length = decimalPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return String.valueOf(decimalPart.charAt(digit-1));
        
    }
1212501
protected function hashOfFiles($fileList)
    {
        // Get hash based on hash of each file
        $hash = '';
        foreach ($fileList as $file) {
            $absolutePath = Director::getAbsFile($file);
            if (file_exists($absolutePath)) {
                $hash .= sha1_file($absolutePath);
            } else {
                throw new InvalidArgumentException("Combined file {$file} does not exist");
            }
        }
        return sha1($hash);
    }
385712
public String getDenominatorPart(final int digit) {
        
        final int length = denominatorPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return String.valueOf(denominatorPart.charAt(length - digit));
    }
728870
public function getCountryCodeAttribute($digits = 2)
    {
        if (! $this->country)
            return '';

        if ($digits === 3)
            return $this->country->iso_3166_3;

        return $this->country->iso_3166_2;
    }
455397
def _get_digit_list(alist: [str], from_index: int) -> ([str], [str]):  # type: ignore
    
    ret = []
    alist.pop(from_index)
    while len(alist) > from_index and alist[from_index].isdigit():
        ret.append(alist.pop(from_index))
    return alist, ret
467619
def group_digits(digits)
      if grouping?
        grouped = []
        i = 0
        while digits.size > 0
          l = @grouping[i]
          l = digits.size if l > digits.size
          grouped = [nil] + grouped if grouped.size > 0
          grouped = digits[-l, l] + grouped
          digits = digits[0, digits.length - l]
          i += 1 if i < @grouping.size - 1
        end
        grouped
      else
        digits
      end
    end
1098494
public function getIDList()
    {
        // Get a list of IDs of our current items - if it's not a number then object then assume it's a DO.
        $ids = array_map(function ($obj) {
            return is_numeric($obj) ? $obj : $obj->ID;
        }, $this->items);

        // Strip out duplicates and anything resolving to False.
        $ids = array_filter(array_unique($ids));

        // Change the array from (1, 2, 3) to (1 => 1, 2 => 2, 3 => 3)
        if ($ids) {
            $ids = array_combine($ids, $ids);
        }

        return $ids;
    }
807221
private function sortIdsBySortingColumn($idList)
    {
        // Only one item, what shall we sort here then?
        if (1 === \count($idList)) {
            return $idList;
        }

        static $sorting;
        if (isset($sorting[$cacheKey = $this->get('id') . \implode(',', $idList)])) {
            return $sorting[$cacheKey];
        }

        // Now sort the values according to our sorting column.
        $filter = $this
            ->getTagMetaModel()
            ->getEmptyFilter()
            ->addFilterRule(new StaticIdList($idList));

        $itemIds = $this->getTagMetaModel()->getIdsFromFilter(
            $filter,
            $this->getSortingColumn(),
            0,
            0,
            $this->getSortDirection()
        );

        // Manual sorting of items for checkbox wizard.
        if ($this->isCheckboxWizard() || $this->isTreePicker()) {
            // Keep order from input array, and add non existent ids to the end.
            return $sorting[$cacheKey] = \array_merge(
                // Keep order from input array...
                \array_intersect($idList, $itemIds),
                // ... and add non existent ids to the end.
                \array_diff($idList, $itemIds)
            );
        }
        // Use new order and add non existent ids to the end.
        return $sorting[$cacheKey] = \array_merge($itemIds, \array_diff($idList, $itemIds));
    }
229212
function(digit) {
			var obj = this.createList(digit, {
				classes: {
					active: this.factory.classes.active,
					before: this.factory.classes.before,
					flip: this.factory.classes.flip
				}
			});
			
			obj.$obj.insertBefore(this.factory.lists[0].$obj);
							
			this.factory.lists.unshift(obj);
		}
433118
public function process($tokenList) {
        $unparsed = $tokenList['INTO'];
        foreach ($unparsed as $k => $token) {
            if ($this->isWhitespaceToken($token) || $this->isCommaToken($token)) {
                unset($unparsed[$k]);
            }
        }
        $tokenList['INTO'] = array_values($unparsed);
        return $tokenList;
    }
1270984
public function getCardinality()
    {
        if (null !== $this->cardinality) {
            return $this->cardinality;
        }
        $lower = $upper = $digits = $symbols = $unicode = 0;

        // Use token instead of password to support bruteforce matches on sub-string
        // of password.
        $chars = str_split($this->token);
        foreach ($chars as $char) {
            $ord = ord($char);

            if ($this->isDigit($ord)) {
                $digits = 10;
            } elseif ($this->isUpper($ord)) {
                $upper = 26;
            } elseif ($this->isLower($ord)) {
                $lower = 26;
            } elseif ($this->isSymbol($ord)) {
                $symbols = 33;
            } else {
                $unicode = 100;
            }
        }
        $this->cardinality = $lower + $digits + $upper + $symbols + $unicode;

        return $this->cardinality;
    }
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 '';
    }
452626
function(digit) {
			if(typeof digit === "undefined") {
				digit = this.digit;
			}
			else {
				this.digit = digit;
			}

			if(this.digit != this.lastDigit) {
				var $delete = this.$el.find('.'+this.classes.before).removeClass(this.classes.before);

				this.$el.find('.'+this.classes.active).removeClass(this.classes.active)
													  .addClass(this.classes.before);

				this.appendListItem(this.classes.active, this.digit);

				$delete.remove();

				this.lastDigit = this.digit;
			}	
		}