protected function standardFieldChecks($marc)
    {
        $fieldsSeen = array();
        foreach ($marc->getFields() as $current) {
            $tagNo = $current->getTag();
            // if 880 field, inherit rules from tagno in subfield _6
            if ($tagNo == 880) {
                if ($sub6 = $current->getSubfield(6)) {
                    $tagNo = substr($sub6->getData(), 0, 3);
                    $tagrules = isset($this->rules[$tagNo])
                        ? $this->rules[$tagNo] : null;
                    // 880 is repeatable, but its linked field may not be
                    if (isset($tagrules['repeatable'])
                        && $tagrules['repeatable'] == 'NR'
                        && isset($fieldsSeen['880.'.$tagNo])
                    ) {
                        $this->warn("$tagNo: Field is not repeatable.");
                    }
                    $fieldsSeen['880.'.$tagNo] = isset($fieldsSeen['880.'.$tagNo])
                        ? $fieldsSeen['880.'.$tagNo] + 1 : 1;
                } else {
                    $this->warn("880: No subfield 6.");
                    $tagRules = null;
                }
            } else {
                // Default case -- not an 880 field:
                $tagrules = isset($this->rules[$tagNo])
                    ? $this->rules[$tagNo] : null;
                if (isset($tagrules['repeatable']) && $tagrules['repeatable'] == 'NR'
                    && isset($fieldsSeen[$tagNo])
                ) {
                    $this->warn("$tagNo: Field is not repeatable.");
                }
                $fieldsSeen[$tagNo] = isset($fieldsSeen[$tagNo])
                    ? $fieldsSeen[$tagNo] + 1 : 1;
            }

            // Treat data fields differently from control fields:
            if (intval(ltrim($tagNo, '0')) >= 10) {
                if (!empty($tagrules)) {
                    $this->checkIndicators($tagNo, $current, $tagrules);
                    $this->checkSubfields($tagNo, $current, $tagrules);
                }
            } else {
                // Control field:
                if (strstr($current->toRaw(), chr(hexdec('1F')))) {
                    $this->warn(
                        "$tagNo: Subfields are not allowed in fields lower than 010"
                    );
                }
            }

            // Check to see if a checkxxx() function exists, and call it on the
            // field if it does
            $method = 'check' . $tagNo;
            if (method_exists($this, $method)) {
                $this->$method($current);
            }
        }
    }
protected function standardFieldChecks($marc)
    {
        $fieldsSeen = array();
        foreach ($marc->getFields() as $current) {
            $tagNo = $current->getTag();
            // if 880 field, inherit rules from tagno in subfield _6
            if ($tagNo == 880) {
                if ($sub6 = $current->getSubfield(6)) {
                    $tagNo = substr($sub6->getData(), 0, 3);
                    $tagrules = isset($this->rules[$tagNo])
                        ? $this->rules[$tagNo] : null;
                    // 880 is repeatable, but its linked field may not be
                    if (isset($tagrules['repeatable'])
                        && $tagrules['repeatable'] == 'NR'
                        && isset($fieldsSeen['880.'.$tagNo])
                    ) {
                        $this->warn("$tagNo: Field is not repeatable.");
                    }
                    $fieldsSeen['880.'.$tagNo] = isset($fieldsSeen['880.'.$tagNo])
                        ? $fieldsSeen['880.'.$tagNo] + 1 : 1;
                } else {
                    $this->warn("880: No subfield 6.");
                    $tagRules = null;
                }
            } else {
                // Default case -- not an 880 field:
                $tagrules = isset($this->rules[$tagNo])
                    ? $this->rules[$tagNo] : null;
                if (isset($tagrules['repeatable']) && $tagrules['repeatable'] == 'NR'
                    && isset($fieldsSeen[$tagNo])
                ) {
                    $this->warn("$tagNo: Field is not repeatable.");
                }
                $fieldsSeen[$tagNo] = isset($fieldsSeen[$tagNo])
                    ? $fieldsSeen[$tagNo] + 1 : 1;
            }

            // Treat data fields differently from control fields:
            if (intval(ltrim($tagNo, '0')) >= 10) {
                if (!empty($tagrules)) {
                    $this->checkIndicators($tagNo, $current, $tagrules);
                    $this->checkSubfields($tagNo, $current, $tagrules);
                }
            } else {
                // Control field:
                if (strstr($current->toRaw(), chr(hexdec('1F')))) {
                    $this->warn(
                        "$tagNo: Subfields are not allowed in fields lower than 010"
                    );
                }
            }

            // Check to see if a checkxxx() function exists, and call it on the
            // field if it does
            $method = 'check' . $tagNo;
            if (method_exists($this, $method)) {
                $this->$method($current);
            }
        }
    }
protected function standardFieldChecks ( $ marc ) { $ fieldsSeen = array ( ) ; foreach ( $ marc -> getFields ( ) as $ current ) { $ tagNo = $ current -> getTag ( ) ; // if 880 field, inherit rules from tagno in subfield _6 if ( $ tagNo == 880 ) { if ( $ sub6 = $ current -> getSubfield ( 6 ) ) { $ tagNo = substr ( $ sub6 -> getData ( ) , 0 , 3 ) ; $ tagrules = isset ( $ this -> rules [ $ tagNo ] ) ? $ this -> rules [ $ tagNo ] : null ; // 880 is repeatable, but its linked field may not be if ( isset ( $ tagrules [ 'repeatable' ] ) && $ tagrules [ 'repeatable' ] == 'NR' && isset ( $ fieldsSeen [ '880.' . $ tagNo ] ) ) { $ this -> warn ( "$tagNo: Field is not repeatable." ) ; } $ fieldsSeen [ '880.' . $ tagNo ] = isset ( $ fieldsSeen [ '880.' . $ tagNo ] ) ? $ fieldsSeen [ '880.' . $ tagNo ] + 1 : 1 ; } else { $ this -> warn ( "880: No subfield 6." ) ; $ tagRules = null ; } } else { // Default case -- not an 880 field: $ tagrules = isset ( $ this -> rules [ $ tagNo ] ) ? $ this -> rules [ $ tagNo ] : null ; if ( isset ( $ tagrules [ 'repeatable' ] ) && $ tagrules [ 'repeatable' ] == 'NR' && isset ( $ fieldsSeen [ $ tagNo ] ) ) { $ this -> warn ( "$tagNo: Field is not repeatable." ) ; } $ fieldsSeen [ $ tagNo ] = isset ( $ fieldsSeen [ $ tagNo ] ) ? $ fieldsSeen [ $ tagNo ] + 1 : 1 ; } // Treat data fields differently from control fields: if ( intval ( ltrim ( $ tagNo , '0' ) ) >= 10 ) { if ( ! empty ( $ tagrules ) ) { $ this -> checkIndicators ( $ tagNo , $ current , $ tagrules ) ; $ this -> checkSubfields ( $ tagNo , $ current , $ tagrules ) ; } } else { // Control field: if ( strstr ( $ current -> toRaw ( ) , chr ( hexdec ( '1F' ) ) ) ) { $ this -> warn ( "$tagNo: Subfields are not allowed in fields lower than 010" ) ; } } // Check to see if a checkxxx() function exists, and call it on the // field if it does $ method = 'check' . $ tagNo ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ current ) ; } } }
Check all fields against the standard rules encoded in the class.

@param File_MARC_Record $marc Record to check

@return void
Check all fields against the standard rules encoded in the class .