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);
    }