-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDataException.php
More file actions
44 lines (39 loc) · 1022 Bytes
/
DataException.php
File metadata and controls
44 lines (39 loc) · 1022 Bytes
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
<?php
namespace Exceptions\Data;
use Exceptions\Helpers\DefaultsInterface;
use RuntimeException;
use Throwable;
/**
* This is a tag like class that is used to regroup all Data exceptions under a single base class.
*
* @author Mathieu Dumoulin <thecrazycodr@gmail.com>
* @license MIT
*/
abstract class DataException extends RuntimeException implements DataExceptionInterface, DefaultsInterface
{
public function __construct(
string $message = "",
int $code = 0,
null|Throwable $previous = null
) {
parent::__construct(
message: $message ?: $this->getDefaultMessage(),
code: $code ?: $this->getDefaultCode(),
previous: $previous
);
}
/**
* {@inheritdoc}
*/
public static function getDefaultMessage(): string
{
return static::MESSAGE;
}
/**
* {@inheritdoc}
*/
public static function getDefaultCode(): int
{
return static::CODE;
}
}