protected function checkSubfields($tagNo, $field, $rules)
    {
        $subSeen = array();

        foreach ($field->getSubfields() as $current) {
            $code = $current->getCode();
            $data = $current->getData();

            $subrules = isset($rules['sub' . $code])
                ? $rules['sub' . $code] : null;

            if (empty($subrules)) {
                $this->warn("$tagNo: Subfield _$code is not allowed.");
            } elseif ($subrules['repeatable'] == 'NR' && isset($subSeen[$code])) {
                $this->warn("$tagNo: Subfield _$code is not repeatable.");
            }

            if (preg_match('/\r|\t|\n/', $data)) {
                $this->warn(
                    "$tagNo: Subfield _$code has an invalid control character"
                );
            }

            $subSeen[$code] = isset($subSeen[$code]) ? $subSeen[$code]++ : 1;
        }
    }
protected function checkSubfields($tagNo, $field, $rules)
    {
        $subSeen = array();

        foreach ($field->getSubfields() as $current) {
            $code = $current->getCode();
            $data = $current->getData();

            $subrules = isset($rules['sub' . $code])
                ? $rules['sub' . $code] : null;

            if (empty($subrules)) {
                $this->warn("$tagNo: Subfield _$code is not allowed.");
            } elseif ($subrules['repeatable'] == 'NR' && isset($subSeen[$code])) {
                $this->warn("$tagNo: Subfield _$code is not repeatable.");
            }

            if (preg_match('/\r|\t|\n/', $data)) {
                $this->warn(
                    "$tagNo: Subfield _$code has an invalid control character"
                );
            }

            $subSeen[$code] = isset($subSeen[$code]) ? $subSeen[$code]++ : 1;
        }
    }
protected function checkSubfields ( $ tagNo , $ field , $ rules ) { $ subSeen = array ( ) ; foreach ( $ field -> getSubfields ( ) as $ current ) { $ code = $ current -> getCode ( ) ; $ data = $ current -> getData ( ) ; $ subrules = isset ( $ rules [ 'sub' . $ code ] ) ? $ rules [ 'sub' . $ code ] : null ; if ( empty ( $ subrules ) ) { $ this -> warn ( "$tagNo: Subfield _$code is not allowed." ) ; } elseif ( $ subrules [ 'repeatable' ] == 'NR' && isset ( $ subSeen [ $ code ] ) ) { $ this -> warn ( "$tagNo: Subfield _$code is not repeatable." ) ; } if ( preg_match ( '/\r|\t|\n/' , $ data ) ) { $ this -> warn ( "$tagNo: Subfield _$code has an invalid control character" ) ; } $ subSeen [ $ code ] = isset ( $ subSeen [ $ code ] ) ? $ subSeen [ $ code ] ++ : 1 ; } }
Check the subfields for the provided field.

@param string          $tagNo Tag number being checked
@param File_MARC_Field $field Field to check
@param array           $rules Rules to use for checking

@return void
Check the subfields for the provided field .