src/File_MARC_Reference.php
private function referenceFields()
    {
        if ($this->fields = $this->cache->getData($this->spec['field'])) {
            return $this->fields;
        }

        if (!$this->fields = $this->referenceFieldsByTag()) {
            return;
        }

        /*
        * filter by indizes
        */
        if ($_indexRange = $this->getIndexRange($this->spec['field'], count($this->fields))) {
            $prevTag = '';
            $index = 0;
            foreach ($this->fields as $position => $field) {
                if (false == ($field instanceof File_MARC_Field)) {
                    continue;
                }
                $tag = $field->getTag();
                $index = ($prevTag == $tag or '' == $prevTag) ? $index : 0;
                if (!in_array($index, $_indexRange)) {
                    unset($this->fields[$position]);
                }
                $index++;
                $prevTag = $tag;
            }
        }

        /*
        * filter for indicator values
        */
        if ($this->spec->offsetExists('indicator')) {
            foreach ($this->fields as $key => $field) {
                // only filter by indicators for data fields
                if (!$field->isDataField()) {
                    // control field have no indicators
                    unset($this->fields[$key]);
                }
            }
        }
    }
private function referenceFields()
    {
        if ($this->fields = $this->cache->getData($this->spec['field'])) {
            return $this->fields;
        }

        if (!$this->fields = $this->referenceFieldsByTag()) {
            return;
        }

        /*
        * filter by indizes
        */
        if ($_indexRange = $this->getIndexRange($this->spec['field'], count($this->fields))) {
            $prevTag = '';
            $index = 0;
            foreach ($this->fields as $position => $field) {
                if (false == ($field instanceof File_MARC_Field)) {
                    continue;
                }
                $tag = $field->getTag();
                $index = ($prevTag == $tag or '' == $prevTag) ? $index : 0;
                if (!in_array($index, $_indexRange)) {
                    unset($this->fields[$position]);
                }
                $index++;
                $prevTag = $tag;
            }
        }

        /*
        * filter for indicator values
        */
        if ($this->spec->offsetExists('indicator')) {
            foreach ($this->fields as $key => $field) {
                // only filter by indicators for data fields
                if (!$field->isDataField()) {
                    // control field have no indicators
                    unset($this->fields[$key]);
                }
            }
        }
    }
private function referenceFields ( ) { if ( $ this -> fields = $ this -> cache -> getData ( $ this -> spec [ 'field' ] ) ) { return $ this -> fields ; } if ( ! $ this -> fields = $ this -> referenceFieldsByTag ( ) ) { return ; } /*
        * filter by indizes
        */ if ( $ _indexRange = $ this -> getIndexRange ( $ this -> spec [ 'field' ] , count ( $ this -> fields ) ) ) { $ prevTag = '' ; $ index = 0 ; foreach ( $ this -> fields as $ position => $ field ) { if ( false == ( $ field instanceof File_MARC_Field ) ) { continue ; } $ tag = $ field -> getTag ( ) ; $ index = ( $ prevTag == $ tag or '' == $ prevTag ) ? $ index : 0 ; if ( ! in_array ( $ index , $ _indexRange ) ) { unset ( $ this -> fields [ $ position ] ) ; } $ index ++ ; $ prevTag = $ tag ; } } /*
        * filter for indicator values
        */ if ( $ this -> spec -> offsetExists ( 'indicator' ) ) { foreach ( $ this -> fields as $ key => $ field ) { // only filter by indicators for data fields if ( ! $ field -> isDataField ( ) ) { // control field have no indicators unset ( $ this -> fields [ $ key ] ) ; } } } }
Reference fields. Filter by index and indicator.

@return array Array of referenced fields
Reference fields . Filter by index and indicator .