Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / psy / psysh / src / ExecutionLoop / Listener.php
1 <?php
2
3 /*
4  * This file is part of Psy Shell.
5  *
6  * (c) 2012-2018 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
12 namespace Psy\ExecutionLoop;
13
14 use Psy\Shell;
15
16 /**
17  * Execution Loop Listener interface.
18  */
19 interface Listener
20 {
21     /**
22      * Determines whether this listener should be active.
23      *
24      * @return bool
25      */
26     public static function isSupported();
27
28     /**
29      * Called once before the REPL session starts.
30      *
31      * @param Shell $shell
32      */
33     public function beforeRun(Shell $shell);
34
35     /**
36      * Called at the start of each loop.
37      *
38      * @param Shell $shell
39      */
40     public function beforeLoop(Shell $shell);
41
42     /**
43      * Called on user input.
44      *
45      * Return a new string to override or rewrite user input.
46      *
47      * @param Shell  $shell
48      * @param string $input
49      *
50      * @return string|null User input override
51      */
52     public function onInput(Shell $shell, $input);
53
54     /**
55      * Called before executing user code.
56      *
57      * Return a new string to override or rewrite user code.
58      *
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 :)
62      *
63      * @param Shell  $shell
64      * @param string $code
65      *
66      * @return string|null User code override
67      */
68     public function onExecute(Shell $shell, $code);
69
70     /**
71      * Called at the end of each loop.
72      *
73      * @param Shell $shell
74      */
75     public function afterLoop(Shell $shell);
76
77     /**
78      * Called once after the REPL session ends.
79      *
80      * @param Shell $shell
81      */
82     public function afterRun(Shell $shell);
83 }