| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the Symfony package. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier <fabien@symfony.com> |
| 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 Symfony\Component\Console; |
| 13 |
|
| 14 |
use Symfony\Component\Console\Event\ConsoleCommandEvent; |
| 15 |
use Symfony\Component\Console\Event\ConsoleErrorEvent; |
| 16 |
use Symfony\Component\Console\Event\ConsoleSignalEvent; |
| 17 |
use Symfony\Component\Console\Event\ConsoleTerminateEvent; |
| 18 |
|
| 19 |
/** |
| 20 |
* Contains all events dispatched by an Application. |
| 21 |
* |
| 22 |
* @author Francesco Levorato <git@flevour.net> |
| 23 |
*/ |
| 24 |
final class ConsoleEvents |
| 25 |
{ |
| 26 |
/** |
| 27 |
* The COMMAND event allows you to attach listeners before any command is |
| 28 |
* executed by the console. It also allows you to modify the command, input and output |
| 29 |
* before they are handed to the command. |
| 30 |
* |
| 31 |
* @Event("Symfony\Component\Console\Event\ConsoleCommandEvent") |
| 32 |
*/ |
| 33 |
public const COMMAND = 'console.command'; |
| 34 |
|
| 35 |
/** |
| 36 |
* The SIGNAL event allows you to perform some actions |
| 37 |
* after the command execution was interrupted. |
| 38 |
* |
| 39 |
* @Event("Symfony\Component\Console\Event\ConsoleSignalEvent") |
| 40 |
*/ |
| 41 |
public const SIGNAL = 'console.signal'; |
| 42 |
|
| 43 |
/** |
| 44 |
* The TERMINATE event allows you to attach listeners after a command is |
| 45 |
* executed by the console. |
| 46 |
* |
| 47 |
* @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent") |
| 48 |
*/ |
| 49 |
public const TERMINATE = 'console.terminate'; |
| 50 |
|
| 51 |
/** |
| 52 |
* The ERROR event occurs when an uncaught exception or error appears. |
| 53 |
* |
| 54 |
* This event allows you to deal with the exception/error or |
| 55 |
* to modify the thrown exception. |
| 56 |
* |
| 57 |
* @Event("Symfony\Component\Console\Event\ConsoleErrorEvent") |
| 58 |
*/ |
| 59 |
public const ERROR = 'console.error'; |
| 60 |
|
| 61 |
/** |
| 62 |
* Event aliases. |
| 63 |
* |
| 64 |
* These aliases can be consumed by RegisterListenersPass. |
| 65 |
*/ |
| 66 |
public const ALIASES = [ |
| 67 |
ConsoleCommandEvent::class => self::COMMAND, |
| 68 |
ConsoleErrorEvent::class => self::ERROR, |
| 69 |
ConsoleSignalEvent::class => self::SIGNAL, |
| 70 |
ConsoleTerminateEvent::class => self::TERMINATE, |
| 71 |
]; |
| 72 |
} |
| 73 |
|