Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ldy
/
phwoolcon
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2761996c
authored
Nov 21, 2020
by
yeran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove license
1 parent
320e8126
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
composer.json
src/Exception/Http/ApiException.php
src/Router.php
composer.json
View file @
2761996
...
...
@@ -3,8 +3,8 @@
"description"
:
"Phalcon"
,
"keywords"
:
[
"phwoolcon"
],
"type"
:
"library"
,
"version"
:
"1.0.
1
"
,
"license"
:
"
Apache-2.0
"
,
"version"
:
"1.0.
2
"
,
"license"
:
""
,
"authors"
:
[
{
"name"
:
"ldy"
,
...
...
@@ -23,8 +23,7 @@
"ext-phalcon"
:
"~3.0"
,
"symfony/console"
:
"~3.0"
,
"pda/pheanstalk"
:
"~3.1"
,
"swiftmailer/swiftmailer"
:
"~5.4|~6.0"
,
"opis/closure"
:
"3.0.1"
"swiftmailer/swiftmailer"
:
"~5.4|~6.0"
},
"require-dev"
:
{
},
...
...
src/Exception/Http/ApiException.php
0 → 100755
View file @
2761996
<?php
/**
* API异常处理
*/
namespace
Phwoolcon\Exception\Http
;
use
Phwoolcon\ErrorCodes
;
use
Throwable
;
class
ApiException
extends
\Exception
{
public
function
__construct
(
$message
=
''
,
int
$code
=
0
,
Throwable
$previous
=
null
)
{
if
(
empty
(
$message
))
{
$errorCode
=
ErrorCodes
::
getCodeMsg
(
$code
);
$message
=
(
$errorCode
&&
count
(
$errorCode
)
==
2
)
?
$errorCode
[
1
]
:
''
;
}
parent
::
__construct
(
$message
,
$code
,
$previous
);
}
public
function
getHeaders
()
{
return
[
'content-type: application/vnd.api+json'
,
'exception-type: ApiException'
,
];
}
public
function
getBody
()
{
return
json_encode
([
'jsonapi'
=>
[
'version'
=>
'1.0'
],
'error'
=>
$this
->
getCode
(),
'error_reason'
=>
$this
->
getMessage
()
]);
}
}
src/Router.php
View file @
2761996
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment