private function sliceData($key, $spec)
    {
        $start = $spec->getIndexStart();
        if ('#' === $start) { // reverse index order
            $end = count($this->data[$key]) - 1;
            $start = $spec->getIndexEnd();
            if ('#' === $start) {
                return [$this->data[$key][$end]];
            }
            $length = $end - $start;

            return array_slice($this->data[$key], $start, $length);
        }
        $end = $spec->getIndexEnd();
        if ('#' === $end) {
            $end = count($this->data[$key]) - 1;
        }
        $length = $end - $start + 1;

        return array_slice($this->data[$key], $start, $length);
    }
private function sliceData($key, $spec)
    {
        $start = $spec->getIndexStart();
        if ('#' === $start) { // reverse index order
            $end = count($this->data[$key]) - 1;
            $start = $spec->getIndexEnd();
            if ('#' === $start) {
                return [$this->data[$key][$end]];
            }
            $length = $end - $start;

            return array_slice($this->data[$key], $start, $length);
        }
        $end = $spec->getIndexEnd();
        if ('#' === $end) {
            $end = count($this->data[$key]) - 1;
        }
        $length = $end - $start + 1;

        return array_slice($this->data[$key], $start, $length);
    }
private function sliceData ( $ key , $ spec ) { $ start = $ spec -> getIndexStart ( ) ; if ( '#' === $ start ) { // reverse index order $ end = count ( $ this -> data [ $ key ] ) - 1 ; $ start = $ spec -> getIndexEnd ( ) ; if ( '#' === $ start ) { return [ $ this -> data [ $ key ] [ $ end ] ] ; } $ length = $ end - $ start ; return array_slice ( $ this -> data [ $ key ] , $ start , $ length ) ; } $ end = $ spec -> getIndexEnd ( ) ; if ( '#' === $ end ) { $ end = count ( $ this -> data [ $ key ] ) - 1 ; } $ length = $ end - $ start + 1 ; return array_slice ( $ this -> data [ $ key ] , $ start , $ length ) ; }
Get a slice from data.

@param string                           $key  The datas key
@param FieldInterface|SubfieldInterface $spec Spec with slice information

@return array[File_MARC_Field|File_MARC_Subfield]
Get a slice from data .