FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
clean-core/src/Error/Error.php at master · g4code/clean-core · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
g4code
/
clean-core
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
clean-core
/
src
/
Error
/
Error.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (48 loc) · 1.46 KB
Breadcrumbs
clean-core
/
src
/
Error
/
Error.php
Copy path
File metadata and controls
57 lines (48 loc) · 1.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
namespace
G4
\
CleanCore
\
Error
;
use
G4
\
CleanCore
\
Response
\
Response
;
use
G4
\
Constants
\
Http
;
class
Error
{
private
\
Exception
$
exception
;
private
Response
$
response
;
public
function
manage
():
void
{
$
this
->
response
->
setResponseMessage
(
$
this
->
getFormattedResponseMessage
())
->
setApplicationResponseCode
(
$
this
->
exception
->
getCode
())
->
setHttpResponseCode
(
$
this
->
getHttpCode
())
->
setResponseObject
([
'
error
'
=> [
'
code
'
=>
$
this
->
exception
->
getCode
(),
'
message
'
=>
$
this
->
exception
->
getMessage
(),
]
]);
}
public
function
setException
(
\
Exception
$
exception
):
self
{
$
this
->
exception
=
$
exception
;
return
$
this
;
}
public
function
setResponse
(
Response
$
response
):
self
{
$
this
->
response
=
$
response
;
return
$
this
;
}
private
function
getHttpCode
()
{
return
\
G4
\
CleanCore
\
Response
\Code::
isValid
(
$
this
->
exception
->
getCode
())
?
$
this
->
exception
->
getCode
()
: Http::
CODE_500
;
}
private
function
getFormattedResponseMessage
():
array
{
return
[
'
code
'
=>
$
this
->
exception
->
getCode
(),
'
message
'
=>
$
this
->
exception
->
getMessage
(),
'
file
'
=>
$
this
->
exception
->
getFile
(),
'
line
'
=>
$
this
->
exception
->
getLine
(),
'
trace
'
=>
$
this
->
exception
->
getTrace
()
];
}
}
Back
|
FazBrowse Home
|
New Git URL