-
-
Notifications
You must be signed in to change notification settings - Fork 453
Expand file tree
/
Copy pathServerUnavailable.php
More file actions
45 lines (35 loc) · 1.08 KB
/
ServerUnavailable.php
File metadata and controls
45 lines (35 loc) · 1.08 KB
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
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use DateTimeImmutable;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class ServerUnavailable extends RuntimeException implements MessagingException
{
use HasErrors;
private ?DateTimeImmutable $retryAfter = null;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self(message: $this->getMessage(), previous: $this->getPrevious());
$new->errors = $errors;
$new->retryAfter = $this->retryAfter;
return $new;
}
public function withRetryAfter(DateTimeImmutable $retryAfter): self
{
$new = new self(message: $this->getMessage(), previous: $this->getPrevious());
$new->errors = $this->errors;
$new->retryAfter = $retryAfter;
return $new;
}
public function retryAfter(): ?DateTimeImmutable
{
return $this->retryAfter;
}
}