-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathError.php
70 lines (57 loc) · 1.49 KB
/
Error.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace App\Custom;
/**
* Sets & Get Errors
*
* This class returns errors.
*
* @category App\Custom
* @package App\Custom\Error
* @author Cedric Maenetja <cedricm@permanentlink.co.za>
* @copyright 2022 Permanent Link CO
* @license Permanent Link CO
* @version Release: 1.0
*/
class Error
{
private $_error;
private $_error_code;
public function __construct ($code, $error)
{
$this->_errors = [];
$this->_error = $error;
$this->_error_code = $code;
$this->SetError ($error);
$this->SetErrorCode ($code);
$this->_errors[] = ['code' => $code, 'error' => $error];
}
public function AddError ($code, $error)
{
$this->_errors[] = ['code' => $code, 'error' => $error];
}
private function SetError ($error)
{
$this->_error = $error;
}
private function SetErrorCode ($code)
{
$this->_error_code = $code;
}
public static function IsAnError ($error)
{
return (is_a ($error, 'App\Custom\Error')) ? true : false;
}
public function GetError()
{
return $this->_error;
}
public function GetErrorCode()
{
return $this->_error_code;
}
public function GetAllErrors()
{
return $this->_errors;
}
}
?>