Looks at 020$a and reports errors if the check digit is wrong.
Looks at 020$z and validates number if hyphens are present.

@param File_MARC_Field $field Field to check

@return void
162491
protected function check020($field)
    {
        foreach ($field->getSubfields() as $current) {
            $data = $current->getData();
            // remove any hyphens
            $isbn = str_replace('-', '', $data);
            // remove nondigits
            $isbn = preg_replace('/^\D*(\d{9,12}[X\d])\b.*$/', '$1', $isbn);

            if ($current->getCode() == 'a') {
                if ((substr($data, 0, strlen($isbn)) != $isbn)) {
                    $this->warn("020: Subfield a may have invalid characters.");
                }

                // report error if no space precedes a qualifier in subfield a
                if (preg_match('/\(/', $data) && !preg_match('/[X0-9] \(/', $data)) {
                    $this->warn(
                        "020: Subfield a qualifier must be preceded by space, $data."
                    );
                }

                // report error if unable to find 10-13 digit string of digits in
                // subfield 'a'
                if (!preg_match('/(?:^\d{10}$)|(?:^\d{13}$)|(?:^\d{9}X$)/', $isbn)) {
                    $this->warn(
                        "020: Subfield a has the wrong number of digits, $data."
                    );
                } else {
                    if (strlen($isbn) == 10) {
                        if (!Validate_ISPN::isbn10($isbn)) {
                            $this->warn("020: Subfield a has bad checksum, $data.");
                        }
                    } else if (strlen($isbn) == 13) {
                        if (!Validate_ISPN::isbn13($isbn)) {
                            $this->warn(
                                "020: Subfield a has bad checksum (13 digit), $data."
                            );
                        }
                    }
                }
            } else if ($current->getCode() == 'z') {
                // look for valid isbn in 020$z
                if (preg_match('/^ISBN/', $data)
                    || preg_match('/^\d*\-\d+/', $data)
                ) {
                    // ##################################################
                    // ## Turned on for now--Comment to unimplement  ####
                    // ##################################################
                    if ((strlen($isbn) == 10)
                        && (Validate_ISPN::isbn10($isbn) == 1)
                    ) {
                        $this->warn("020:  Subfield z is numerically valid.");
                    }
                }
            }
        }
    }
868081
public function imageValidator(string $field, $suffixes = null): bool
    {
        if (!$file = $this->uploadedFiles[$field] ?? null) {
            return false;
        }

        if (!isset($file['error']) || ($file['error'] !== \UPLOAD_ERR_OK)) {
            return false;
        }

        if (!$tmpFile = $file['tmp_name'] ?? null) {
            return false;
        }

        // getimagesize() 判定某个文件是否为图片的有效手段, 常用在文件上传验证
        // Note: 本函数不需要 GD 图像库
        // list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
        $imgInfo = @\getimagesize($tmpFile);

        if ($imgInfo && $imgInfo[2]) {
            $mime = \strtolower($imgInfo['mime']); // 支持不标准扩展名

            // 是否是图片
            if (!\in_array($mime, Helper::$imgMimeTypes, true)) {
                return false;
            }

            if (!$suffixes) {
                return true;
            }

            $suffix   = Helper::getImageExtByMime($mime);
            $suffixes = \is_string($suffixes) ? Filters::explode($suffixes) : (array)$suffixes;

            return \in_array($suffix, $suffixes, true);
        }

        return false;
    }
481014
public function error($field)
    {
        return ($this->submitted && isset($this->errors[$field])) ? $this->errors[$field] : null;
    }
25296
protected function verifyNonNegativeField($field, $value)
    {
        if (!empty($value) && $value <= 0) {
            throw new \Genesis\Exceptions\ErrorParameter(
                sprintf(
                    'Item parameter %s is set to %s, but expected to be positive number',
                    $field,
                    $value
                )
            );
        }
    }
802303
protected function validateFieldAddress($field)
    {
        if ($this->isExcluded($field) || $this->isError('country')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $format = $this->getCountryFormatAddress();

        if (empty($format[$field]['required'])) {
            return null;
        }

        if (!isset($value) || $value === '' || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $format[$field]['name'], 1, 255);
            return false;
        }

        return true;
    }
472713
protected function checkState($field)
    {
        if (is_int($field)) {
            $this->preparePositional();
        }

        if (count($this->getFields()) > 0) {
            if (is_string($field) && $this->isPositional()) {
                throw new BuilderException("Cannot add named argument to positional arguments");
            } else {
                parent::checkState($field);
            }
        }
    }
876766
public function isValidField(string $field): bool {
        $result = empty($this->errors[$field]);
        return $result;
    }
741845
public function eval_cron_field($field, $min, $max) {
        // Cleanse the input.
        $field = trim($field);

        // Format for a field is:
        // <fieldlist> := <range>(/<step>)(,<fieldlist>)
        // <step>  := int
        // <range> := <any>|<int>|<min-max>
        // <any>   := *
        // <min-max> := int-int
        // End of format BNF.

        // This function is complicated but is covered by unit tests.
        $range = array();

        $matches = array();
        preg_match_all('@[0-9]+|\*|,|/|-@', $field, $matches);

        $last = 0;
        $inrange = false;
        $instep = false;

        foreach ($matches[0] as $match) {
            if ($match == '*') {
                array_push($range, range($min, $max));
            } else if ($match == '/') {
                $instep = true;
            } else if ($match == '-') {
                $inrange = true;
            } else if (is_numeric($match)) {
                if ($instep) {
                    $i = 0;
                    for ($i = 0; $i < count($range[count($range) - 1]); $i++) {
                        if (($i) % $match != 0) {
                            $range[count($range) - 1][$i] = -1;
                        }
                    }
                    $inrange = false;
                } else if ($inrange) {
                    if (count($range)) {
                        $range[count($range) - 1] = range($last, $match);
                    }
                    $inrange = false;
                } else {
                    if ($match >= $min && $match <= $max) {
                        array_push($range, $match);
                    }
                    $last = $match;
                }
            }
        }

        // Flatten the result.
        $result = array();
        foreach ($range as $r) {
            if (is_array($r)) {
                foreach ($r as $rr) {
                    if ($rr >= $min && $rr <= $max) {
                        $result[$rr] = 1;
                    }
                }
            } else if (is_numeric($r)) {
                if ($r >= $min && $r <= $max) {
                    $result[$r] = 1;
                }
            }
        }
        $result = array_keys($result);
        sort($result, SORT_NUMERIC);
        return $result;
    }
778578
public function checkRecord($marc)
    {
        // Reset warnings:
        $this->warnings = array();

        // Fail if we didn't get a valid object:
        if (!is_a($marc, 'File_MARC_Record')) {
            $this->warn('Must pass a File_MARC_Record object to checkRecord');
        } else {
            $this->checkDuplicate1xx($marc);
            $this->checkMissing245($marc);
            $this->standardFieldChecks($marc);
        }

        return $this->warnings;
    }
835710
protected function validateNumber($value, ValidationField $field) {
        $result = filter_var($value, FILTER_VALIDATE_FLOAT);
        if ($result === false) {
            $field->addTypeError($value, 'number');
            return Invalid::value();
        }

        $result = $this->validateNumberProperties($result, $field);

        return $result;
    }
1121398
private function _checkInt(&$int, $field)
    {
        if (!isset($int)) {
            throw new Klarna_ArgumentNotSetException($field);
        }
        if (is_numeric($int) && !is_int($int)) {
            $int = intval($int);
        }
        if (!is_numeric($int) || !is_int($int)) {
            throw new Klarna_InvalidTypeException($field, "integer");
        }
    }
1110634
private void initPrefixStatsField(String field) {
    if (!singlePositionPrefix.containsKey(field)) {
      singlePositionPrefix.put(field, new HashSet<String>());
    }
    if (!multiplePositionPrefix.containsKey(field)) {
      multiplePositionPrefix.put(field, new HashSet<String>());
    }
    if (!setPositionPrefix.containsKey(field)) {
      setPositionPrefix.put(field, new HashSet<String>());
    }
  }
898076
private function addLengthError($name, $min, $max, $field = null): void
    {
        $isMinZero = ($min === 0);
        $isMaxBig = ($max > 200);

        if ($isMinZero) {
            $msg = sprintf('%s must be %d characters or fewer', $name, $max);

        } elseif ($isMaxBig) {
            $msg = sprintf('%s must be %d characters or more', $name, $min);

        } else {
            $msg = sprintf('%s must contain %d - %d characters', $name, $min, $max);
        }

        $this->addError($msg, $field);
    }
257735
protected static function isExpression($field)
    {
        $alias = explode(' as ', $field);
        $field = trim($alias[0]);
        if (preg_match('/\S+\(\S*\)/', $field) === 1) {
            if (isset($alias[1])) {
                return trim($alias[1]);
            }

            return true;
        }

        return false;
    }
932782
private function validateNumberProperties($value, ValidationField $field) {
        $count = $field->getErrorCount();

        if ($multipleOf = $field->val('multipleOf')) {
            $divided = $value / $multipleOf;

            if ($divided != round($divided)) {
                $field->addError('multipleOf', ['messageCode' => 'The value must be a multiple of {multipleOf}.', 'multipleOf' => $multipleOf]);
            }
        }

        if ($maximum = $field->val('maximum')) {
            $exclusive = $field->val('exclusiveMaximum');

            if ($value > $maximum || ($exclusive && $value == $maximum)) {
                if ($exclusive) {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than {maximum}.', 'maximum' => $maximum]);
                } else {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than or equal to {maximum}.', 'maximum' => $maximum]);
                }
            }
        }

        if ($minimum = $field->val('minimum')) {
            $exclusive = $field->val('exclusiveMinimum');

            if ($value < $minimum || ($exclusive && $value == $minimum)) {
                if ($exclusive) {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than {minimum}.', 'minimum' => $minimum]);
                } else {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than or equal to {minimum}.', 'minimum' => $minimum]);
                }
            }
        }

        return $field->getErrorCount() === $count ? $value : Invalid::value();
    }
534496
public function format_money($field)
    {
        // use real number formatter
        $this->format_real($field);

        // negative values show in red color
        if ($this->current_row[$field] < 0) {
            $this->setTDParam($field, 'style/color', 'red');
        } else {
            $this->setTDParam($field, 'style/color', false);
        }
    }
1255145
public function fileValidator(string $field, $suffixes = null): bool
    {
        if (!$file = $this->uploadedFiles[$field] ?? null) {
            return false;
        }

        if (!isset($file['error']) || ($file['error'] !== \UPLOAD_ERR_OK)) {
            return false;
        }

        if (!$suffixes) {
            return true;
        }

        if (!$suffix = \trim(\strrchr($file['name'], '.'), '.')) {
            return false;
        }

        $suffixes = \is_string($suffixes) ? Filters::explode($suffixes) : (array)$suffixes;

        return \in_array(\strtolower($suffix), $suffixes, true);
    }