1<?php 2 3/* 4 * This file is part of Psy Shell. 5 * 6 * (c) 2012-2020 Justin Hileman 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Psy\Readline; 13 14/** 15 * An interface abstracting the various readline_* functions. 16 */ 17interface Readline 18{ 19 /** 20 * Check whether this Readline class is supported by the current system. 21 * 22 * @return bool 23 */ 24 public static function isSupported(); 25 26 /** 27 * Add a line to the command history. 28 * 29 * @param string $line 30 * 31 * @return bool Success 32 */ 33 public function addHistory($line); 34 35 /** 36 * Clear the command history. 37 * 38 * @return bool Success 39 */ 40 public function clearHistory(); 41 42 /** 43 * List the command history. 44 * 45 * @return array 46 */ 47 public function listHistory(); 48 49 /** 50 * Read the command history. 51 * 52 * @return bool Success 53 */ 54 public function readHistory(); 55 56 /** 57 * Read a single line of input from the user. 58 * 59 * @param string|null $prompt 60 * 61 * @return false|string 62 */ 63 public function readline($prompt = null); 64 65 /** 66 * Redraw readline to redraw the display. 67 */ 68 public function redisplay(); 69 70 /** 71 * Write the command history to a file. 72 * 73 * @return bool Success 74 */ 75 public function writeHistory(); 76} 77