4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\ExecutionLoop;
17 * Execution Loop Listener interface.
22 * Determines whether this listener should be active.
26 public static function isSupported();
29 * Called once before the REPL session starts.
33 public function beforeRun(Shell $shell);
36 * Called at the start of each loop.
40 public function beforeLoop(Shell $shell);
43 * Called on user input.
45 * Return a new string to override or rewrite user input.
48 * @param string $input
50 * @return string|null User input override
52 public function onInput(Shell $shell, $input);
55 * Called before executing user code.
57 * Return a new string to override or rewrite user code.
59 * Note that this is run *after* the Code Cleaner, so if you return invalid
60 * or unsafe PHP here, it'll be executed without any of the safety Code
61 * Cleaner provides. This comes with the big kid warranty :)
66 * @return string|null User code override
68 public function onExecute(Shell $shell, $code);
71 * Called at the end of each loop.
75 public function afterLoop(Shell $shell);
78 * Called once after the REPL session ends.
82 public function afterRun(Shell $shell);