Primo Committ

This commit is contained in:
paoloar77
2024-05-07 12:17:25 +02:00
commit e73d0e5113
7204 changed files with 884387 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class CannotCreateDbDumper extends Exception
{
public static function unsupportedDriver(string $driver): self
{
return new static("Cannot create a dumper for db driver `{$driver}`. Use `mysql`, `pgsql`, `mongodb` or `sqlite`.");
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class InvalidBackupDestination extends Exception
{
public static function diskNotSet(string $backupName): self
{
return new static("There is no disk set for the backup named `{$backupName}`.");
}
public static function connectionError(string $diskName): self
{
return new static ("There is a connection error when trying to connect to disk named `{$diskName}`");
}
public static function writeError(string $diskName): self
{
return new static ("There was an error trying to write to disk named `{$diskName}`");
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class InvalidBackupJob extends Exception
{
public static function noDestinationsSpecified(): self
{
return new static('A backup job cannot run without a destination to backup to!');
}
public static function destinationDoesNotExist(string $diskName): self
{
return new static("There is no backup destination with a disk named `{$diskName}`.");
}
public static function noFilesToBeBackedUp(): self
{
return new static('There are no files to be backed up.');
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class InvalidCommand extends Exception
{
public static function create(string $reason): self
{
return new static($reason);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class InvalidConfiguration extends Exception
{
public static function cannotUseUnsupportedDriver(string $connectionName, string $driverName): self
{
return new static("Db connection `{$connectionName}` uses an unsupported driver `{$driverName}`. Only `mysql` and `pgsql` are supported.");
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class InvalidHealthCheck extends Exception
{
public static function because(string $message): self
{
return new static($message);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Spatie\Backup\Exceptions;
use Exception;
class NotificationCouldNotBeSent extends Exception
{
public static function noNotificationClassForEvent($event): self
{
$eventClass = get_class($event);
return new static("There is no notification class that can handle event `{$eventClass}`.");
}
}