-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathError.php
More file actions
44 lines (36 loc) · 853 Bytes
/
Copy pathError.php
File metadata and controls
44 lines (36 loc) · 853 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
/**
* Qubus\Error
*
* @link https://github.com/QubusPHP/error
* @copyright 2022
* @author Joshua Parker <joshua@joshuaparker.dev>
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
declare(strict_types=1);
namespace Qubus\Error;
class Error implements Returnable
{
public function __construct(
protected string $message = '',
protected int|string $code = '',
protected $context = []
) {
}
public function getMessage(): string
{
return $this->message;
}
public function getCode(): int
{
return $this->code;
}
public function getContext(): array
{
return $this->context;
}
public function __toString(): string
{
return sprintf('%s:: %s', (string) $this->code, $this->message);
}
}