Passed
Push — master ( 4e3c19...6e35e1 )
by Fabio
06:44 queued 01:59
created

TExitException::getExitCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * TExitException file
4
 *
5
 * @author Brad Anderson <[email protected]>
6
 * @link https://github.com/pradosoft/prado
7
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
8
 */
9
10
namespace Prado\Exceptions;
11
12
/**
13
 * TExitException class
14
 *
15
 * Throwing TExitException will interrupt the application and gracefully terminate.
16
 * The application will exit with the specified {@link getExitCode Exit Code}.
17
 *
18
 * This exception is not designed to be caught by any class other than TApplication.
19
 * If this exception is caught, it may interfere with the graceful termination of
20
 * the application.
21
 *
22
 * @author Brad Anderson <[email protected]>
23
 * @since 4.2.3
24
 */
25
class TExitException extends TSystemException
26
{
27
	/**
28
	 * @var int The exit code
29
	 */
30
	protected int $_exitCode;
31
32
	/**
33
	 * Constructor.
34
	 * @param int $exitCode The status exit code.
35
	 * @param ?string $message The error message.
36
	 * @param array $args All the additional parameters.
37
	 */
38
	public function __construct(int $exitCode = 0, ?string $message = null, ...$args)
39
	{
40
		$this->_exitCode = $exitCode;
41
		parent::__construct($message, ...$args);
42
	}
43
44
	/**
45
	 * @return int The exit code to end the application process.
46
	 */
47
	public function getExitCode(): int
48
	{
49
		return $this->_exitCode;
50
	}
51
}
52