/
MaintenanceModeException.php
54 lines (45 loc) · 1.32 KB
/
MaintenanceModeException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Illuminate\Foundation\Http\Exceptions;
use Exception;
use Illuminate\Support\Carbon;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
class MaintenanceModeException extends ServiceUnavailableHttpException
{
/**
* When the application was put in maintenance mode.
*
* @var \Illuminate\Support\Carbon
*/
public $wentDownAt;
/**
* The number of seconds to wait before retrying.
*
* @var int
*/
public $retryAfter;
/**
* When the application should next be available.
*
* @var \Illuminate\Support\Carbon
*/
public $willBeAvailableAt;
/**
* Create a new exception instance.
*
* @param int $time
* @param int $retryAfter
* @param string $message
* @param \Exception $previous
* @param int $code
* @return void
*/
public function __construct($time, $retryAfter = null, $message = null, Exception $previous = null, $code = 0)
{
parent::__construct($retryAfter, $message, $previous, $code);
$this->wentDownAt = Carbon::createFromTimestamp($time);
if ($retryAfter) {
$this->retryAfter = $retryAfter;
$this->willBeAvailableAt = Carbon::createFromTimestamp($time)->addSeconds($this->retryAfter);
}
}
}