allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s

This commit is contained in:
2026-03-30 14:54:57 +07:00
parent 66aed7c4e8
commit b5e3a778ce
21316 changed files with 2777892 additions and 13 deletions

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class ApiConnectionFailed extends RuntimeException implements MessagingException
{
use HasErrors;
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class AuthenticationError extends RuntimeException implements MessagingException
{
use HasErrors;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
return $new;
}
}

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\InvalidArgumentException;
use Kreait\Firebase\Exception\MessagingException;
final class InvalidArgument extends InvalidArgumentException implements MessagingException
{
use HasErrors;
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class InvalidMessage extends RuntimeException implements MessagingException
{
use HasErrors;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
return $new;
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class MessagingError extends RuntimeException implements MessagingException
{
use HasErrors;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
return $new;
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class NotFound extends RuntimeException implements MessagingException
{
use HasErrors;
/**
* @var non-empty-string|null
*/
private ?string $token = null;
/**
* @param non-empty-string $token
* @param array<mixed> $errors
*/
public static function becauseTokenNotFound(string $token, array $errors = []): self
{
$message = <<<MESSAGE
The message could not be delivered to the device identified by '{$token}'.
Although the token is syntactically correct, it is not known to the Firebase
project you are using. This could have the following reasons:
- The token has been unregistered from the project. This can happen when a user
has logged out from the application on the given client, or if they have
uninstalled or re-installed the application.
- The token has been registered to a different Firebase project than the project
you are using to send the message. A common reason for this is when you work
with different application environments and are sending a message from one
environment to a device in another environment.
MESSAGE;
$notFound = new self($message);
$notFound->errors = $errors;
$notFound->token = $token;
return $notFound;
}
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
return $new;
}
public function token(): ?string
{
return $this->token;
}
}

View File

@@ -0,0 +1,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 QuotaExceeded extends RuntimeException implements MessagingException
{
use HasErrors;
private ?DateTimeImmutable $retryAfter = null;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
$new->retryAfter = $this->retryAfter;
return $new;
}
public function withRetryAfter(DateTimeImmutable $retryAfter): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $this->errors;
$new->retryAfter = $retryAfter;
return $new;
}
public function retryAfter(): ?DateTimeImmutable
{
return $this->retryAfter;
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Kreait\Firebase\Exception\Messaging;
use Kreait\Firebase\Exception\HasErrors;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Exception\RuntimeException;
final class ServerError extends RuntimeException implements MessagingException
{
use HasErrors;
/**
* @internal
*
* @param array<mixed> $errors
*/
public function withErrors(array $errors): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
return $new;
}
}

View File

@@ -0,0 +1,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($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $errors;
$new->retryAfter = $this->retryAfter;
return $new;
}
public function withRetryAfter(DateTimeImmutable $retryAfter): self
{
$new = new self($this->getMessage(), $this->getCode(), $this->getPrevious());
$new->errors = $this->errors;
$new->retryAfter = $retryAfter;
return $new;
}
public function retryAfter(): ?DateTimeImmutable
{
return $this->retryAfter;
}
}