|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Lenevor Framework |
|
5
|
|
|
* |
|
6
|
|
|
* LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the new BSD license that is bundled |
|
9
|
|
|
* with this package in the file license.md. |
|
10
|
|
|
* It is also available through the world-wide-web at this URL: |
|
11
|
|
|
* https://lenevor.com/license |
|
12
|
|
|
* If you did not receive a copy of the license and are unable to |
|
13
|
|
|
* obtain it through the world-wide-web, please send an email |
|
14
|
|
|
* to [email protected] so we can send you a copy immediately. |
|
15
|
|
|
* |
|
16
|
|
|
* @package Lenevor |
|
17
|
|
|
* @subpackage Base |
|
18
|
|
|
* @link https://lenevor.com |
|
19
|
|
|
* @copyright Copyright (c) 2019 - 2023 Alexander Campo <[email protected]> |
|
20
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace Syscodes\Components\Debug\Handlers; |
|
24
|
|
|
|
|
25
|
|
|
use Syscodes\Components\Contracts\Debug\MainHandler; |
|
26
|
|
|
use Syscodes\Components\Debug\FrameHandler\Supervisor; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Abstract implementation of a Handler. |
|
30
|
|
|
*/ |
|
31
|
|
|
abstract class Handler implements MainHandler |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* The Handler has handled the Throwable in some way, and wishes to skip any other Handler. |
|
35
|
|
|
* Execution will continue. |
|
36
|
|
|
*/ |
|
37
|
|
|
const LAST_HANDLER = 0x20; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* The Handler has handled the Throwable in some way, and wishes to quit/stop execution. |
|
41
|
|
|
*/ |
|
42
|
|
|
const QUIT = 0x30; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get debug. |
|
46
|
|
|
* |
|
47
|
|
|
* @var \Syscodes\Components\Contracts\Debug\Handler $debug |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $debug; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Get exception. |
|
53
|
|
|
* |
|
54
|
|
|
* @var \Throwable $exception |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $exception; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Get supervisor. |
|
60
|
|
|
* |
|
61
|
|
|
* @var string $supervisor |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $supervisor; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Gets Debug class with you interface. |
|
67
|
|
|
* |
|
68
|
|
|
* @return \Syscodes\Components\Contracts\Debug\Handler Interface |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getDebug() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->debug; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Sets debug. |
|
77
|
|
|
* |
|
78
|
|
|
* @param \Syscodes\Components\Contracts\Debug\Handler $debug |
|
79
|
|
|
* |
|
80
|
|
|
* @return void |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setDebug($debug): void |
|
83
|
|
|
{ |
|
84
|
|
|
$this->debug = $debug; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Gets exception already specified. |
|
89
|
|
|
* |
|
90
|
|
|
* @return \Throwable |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getException() |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->exception; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Sets exception. |
|
99
|
|
|
* |
|
100
|
|
|
* @param \Throwable $exception |
|
101
|
|
|
* |
|
102
|
|
|
* @return void |
|
103
|
|
|
*/ |
|
104
|
|
|
public function setException($exception): void |
|
105
|
|
|
{ |
|
106
|
|
|
$this->exception = $exception; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Gets supervisor already specified. |
|
111
|
|
|
* |
|
112
|
|
|
* @return \Syscodes\Components\Debug\FrameHandler\Supervisor |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getSupervisor() |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->supervisor; |
|
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Sets supervisor. |
|
121
|
|
|
* |
|
122
|
|
|
* @param \Syscodes\Components\Debug\FrameHandler\Supervisor $supervisor |
|
123
|
|
|
* |
|
124
|
|
|
* @return void |
|
125
|
|
|
*/ |
|
126
|
|
|
public function setSupervisor(Supervisor $supervisor): void |
|
127
|
|
|
{ |
|
128
|
|
|
$this->supervisor = $supervisor; |
|
|
|
|
|
|
129
|
|
|
} |
|
130
|
|
|
} |