diff options
Diffstat (limited to 'vendor/symfony/console/Event/ConsoleSignalEvent.php')
-rw-r--r-- | vendor/symfony/console/Event/ConsoleSignalEvent.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/symfony/console/Event/ConsoleSignalEvent.php b/vendor/symfony/console/Event/ConsoleSignalEvent.php new file mode 100644 index 0000000..b27f08a --- /dev/null +++ b/vendor/symfony/console/Event/ConsoleSignalEvent.php | |||
@@ -0,0 +1,56 @@ | |||
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\Event; | ||
13 | |||
14 | use Symfony\Component\Console\Command\Command; | ||
15 | use Symfony\Component\Console\Input\InputInterface; | ||
16 | use Symfony\Component\Console\Output\OutputInterface; | ||
17 | |||
18 | /** | ||
19 | * @author marie <marie@users.noreply.github.com> | ||
20 | */ | ||
21 | final class ConsoleSignalEvent extends ConsoleEvent | ||
22 | { | ||
23 | public function __construct( | ||
24 | Command $command, | ||
25 | InputInterface $input, | ||
26 | OutputInterface $output, | ||
27 | private int $handlingSignal, | ||
28 | private int|false $exitCode = 0, | ||
29 | ) { | ||
30 | parent::__construct($command, $input, $output); | ||
31 | } | ||
32 | |||
33 | public function getHandlingSignal(): int | ||
34 | { | ||
35 | return $this->handlingSignal; | ||
36 | } | ||
37 | |||
38 | public function setExitCode(int $exitCode): void | ||
39 | { | ||
40 | if ($exitCode < 0 || $exitCode > 255) { | ||
41 | throw new \InvalidArgumentException('Exit code must be between 0 and 255.'); | ||
42 | } | ||
43 | |||
44 | $this->exitCode = $exitCode; | ||
45 | } | ||
46 | |||
47 | public function abortExit(): void | ||
48 | { | ||
49 | $this->exitCode = false; | ||
50 | } | ||
51 | |||
52 | public function getExitCode(): int|false | ||
53 | { | ||
54 | return $this->exitCode; | ||
55 | } | ||
56 | } | ||