public function limitHistory($limit)
    {
        $this->historyLimit = $limit === null ? null : $limit;

        // limit send and currently exceeded
        if ($this->historyLimit !== null && isset($this->historyLines[$this->historyLimit])) {
            // adjust position in history according to new position after applying limit
            if ($this->historyPosition !== null) {
                $this->historyPosition -= count($this->historyLines) - $this->historyLimit;

                // current position will drop off from list => restore original
                if ($this->historyPosition < 0) {
                    $this->setInput($this->historyUnsaved);
                    $this->historyPosition = null;
                    $this->historyUnsaved = null;
                }
            }

            $this->historyLines = array_slice($this->historyLines, -$this->historyLimit, $this->historyLimit);
        }

        return $this;
    }
public function limitHistory($limit)
    {
        $this->historyLimit = $limit === null ? null : $limit;

        // limit send and currently exceeded
        if ($this->historyLimit !== null && isset($this->historyLines[$this->historyLimit])) {
            // adjust position in history according to new position after applying limit
            if ($this->historyPosition !== null) {
                $this->historyPosition -= count($this->historyLines) - $this->historyLimit;

                // current position will drop off from list => restore original
                if ($this->historyPosition < 0) {
                    $this->setInput($this->historyUnsaved);
                    $this->historyPosition = null;
                    $this->historyUnsaved = null;
                }
            }

            $this->historyLines = array_slice($this->historyLines, -$this->historyLimit, $this->historyLimit);
        }

        return $this;
    }
public function limitHistory ( $ limit ) { $ this -> historyLimit = $ limit === null ? null : $ limit ; // limit send and currently exceeded if ( $ this -> historyLimit !== null && isset ( $ this -> historyLines [ $ this -> historyLimit ] ) ) { // adjust position in history according to new position after applying limit if ( $ this -> historyPosition !== null ) { $ this -> historyPosition -= count ( $ this -> historyLines ) - $ this -> historyLimit ; // current position will drop off from list => restore original if ( $ this -> historyPosition < 0 ) { $ this -> setInput ( $ this -> historyUnsaved ) ; $ this -> historyPosition = null ; $ this -> historyUnsaved = null ; } } $ this -> historyLines = array_slice ( $ this -> historyLines , - $ this -> historyLimit , $ this -> historyLimit ) ; } return $ this ; }
Limits the history to a maximum of N entries and truncates the current history list accordingly

@param int|null $limit
@return self
Limits the history to a maximum of N entries and truncates the current history list accordingly