src/File_MARC_Reference.php
private function getIndexRange($spec, $total)
    {
        $lastIndex = $total - 1;
        $indexStart = $spec['indexStart'];
        $indexEnd = $spec['indexEnd'];
        if ('#' === $indexStart) {
            if ('#' === $indexEnd or 0 === $indexEnd) {
                return [$lastIndex];
            }
            $indexStart = $lastIndex;
            $indexEnd = $lastIndex - $indexEnd;
            $indexEnd = (0 > $indexEnd) ? 0 : $indexEnd;
        } else {
            if ($lastIndex < $indexStart) {
                return [$indexStart]; // this will result to no hits
            }

            $indexEnd = ('#' === $indexEnd) ? $lastIndex : $indexEnd;
            if ($indexEnd > $lastIndex) {
                $indexEnd = $lastIndex;
            }
        }

        return range($indexStart, $indexEnd);
    }
private function getIndexRange($spec, $total)
    {
        $lastIndex = $total - 1;
        $indexStart = $spec['indexStart'];
        $indexEnd = $spec['indexEnd'];
        if ('#' === $indexStart) {
            if ('#' === $indexEnd or 0 === $indexEnd) {
                return [$lastIndex];
            }
            $indexStart = $lastIndex;
            $indexEnd = $lastIndex - $indexEnd;
            $indexEnd = (0 > $indexEnd) ? 0 : $indexEnd;
        } else {
            if ($lastIndex < $indexStart) {
                return [$indexStart]; // this will result to no hits
            }

            $indexEnd = ('#' === $indexEnd) ? $lastIndex : $indexEnd;
            if ($indexEnd > $lastIndex) {
                $indexEnd = $lastIndex;
            }
        }

        return range($indexStart, $indexEnd);
    }
private function getIndexRange ( $ spec , $ total ) { $ lastIndex = $ total - 1 ; $ indexStart = $ spec [ 'indexStart' ] ; $ indexEnd = $ spec [ 'indexEnd' ] ; if ( '#' === $ indexStart ) { if ( '#' === $ indexEnd or 0 === $ indexEnd ) { return [ $ lastIndex ] ; } $ indexStart = $ lastIndex ; $ indexEnd = $ lastIndex - $ indexEnd ; $ indexEnd = ( 0 > $ indexEnd ) ? 0 : $ indexEnd ; } else { if ( $ lastIndex < $ indexStart ) { return [ $ indexStart ] ; // this will result to no hits } $ indexEnd = ( '#' === $ indexEnd ) ? $ lastIndex : $ indexEnd ; if ( $ indexEnd > $ lastIndex ) { $ indexEnd = $ lastIndex ; } } return range ( $ indexStart , $ indexEnd ) ; }
Calculates a range from indexStart and indexEnd.

@param array $spec  The spec with possible indizes
@param int   $total Total count of (sub)fields

@return array The range of indizes
Calculates a range from indexStart and indexEnd .