private function getHistorySlice($show, $head, $tail)
    {
        $history = $this->readline->listHistory();

        // don't show the current `history` invocation
        \array_pop($history);

        if ($show) {
            list($start, $end) = $this->extractRange($show);
            $length = $end - $start;
        } elseif ($head) {
            if (!\preg_match('/^\d+$/', $head)) {
                throw new \InvalidArgumentException('Please specify an integer argument for --head');
            }

            $start  = 0;
            $length = \intval($head);
        } elseif ($tail) {
            if (!\preg_match('/^\d+$/', $tail)) {
                throw new \InvalidArgumentException('Please specify an integer argument for --tail');
            }

            $start  = \count($history) - $tail;
            $length = \intval($tail) + 1;
        } else {
            return $history;
        }

        return \array_slice($history, $start, $length, true);
    }
private function getHistorySlice($show, $head, $tail)
    {
        $history = $this->readline->listHistory();

        // don't show the current `history` invocation
        \array_pop($history);

        if ($show) {
            list($start, $end) = $this->extractRange($show);
            $length = $end - $start;
        } elseif ($head) {
            if (!\preg_match('/^\d+$/', $head)) {
                throw new \InvalidArgumentException('Please specify an integer argument for --head');
            }

            $start  = 0;
            $length = \intval($head);
        } elseif ($tail) {
            if (!\preg_match('/^\d+$/', $tail)) {
                throw new \InvalidArgumentException('Please specify an integer argument for --tail');
            }

            $start  = \count($history) - $tail;
            $length = \intval($tail) + 1;
        } else {
            return $history;
        }

        return \array_slice($history, $start, $length, true);
    }
private function getHistorySlice ( $ show , $ head , $ tail ) { $ history = $ this -> readline -> listHistory ( ) ; // don't show the current `history` invocation \ array_pop ( $ history ) ; if ( $ show ) { list ( $ start , $ end ) = $ this -> extractRange ( $ show ) ; $ length = $ end - $ start ; } elseif ( $ head ) { if ( ! \ preg_match ( '/^\d+$/' , $ head ) ) { throw new \ InvalidArgumentException ( 'Please specify an integer argument for --head' ) ; } $ start = 0 ; $ length = \ intval ( $ head ) ; } elseif ( $ tail ) { if ( ! \ preg_match ( '/^\d+$/' , $ tail ) ) { throw new \ InvalidArgumentException ( 'Please specify an integer argument for --tail' ) ; } $ start = \ count ( $ history ) - $ tail ; $ length = \ intval ( $ tail ) + 1 ; } else { return $ history ; } return \ array_slice ( $ history , $ start , $ length , true ) ; }
Retrieve a slice of the readline history.

@param string $show
@param string $head
@param string $tail

@return array A slilce of history
Retrieve a slice of the readline history .