Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
b196313b
Commit
b196313b
authored
Aug 15, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring database and error classes.
parent
d72f2c64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
db.php
system/db.php
+1
-4
error.php
system/error.php
+14
-1
No files found.
system/db.php
View file @
b196313b
...
@@ -20,10 +20,7 @@ class DB {
...
@@ -20,10 +20,7 @@ class DB {
*/
*/
public
static
function
connection
(
$connection
=
null
)
public
static
function
connection
(
$connection
=
null
)
{
{
if
(
is_null
(
$connection
))
if
(
is_null
(
$connection
))
$connection
=
Config
::
get
(
'db.default'
);
{
$connection
=
Config
::
get
(
'db.default'
);
}
if
(
!
array_key_exists
(
$connection
,
static
::
$connections
))
if
(
!
array_key_exists
(
$connection
,
static
::
$connections
))
{
{
...
...
system/error.php
View file @
b196313b
...
@@ -38,7 +38,7 @@ class Error {
...
@@ -38,7 +38,7 @@ class Error {
$severity
=
(
array_key_exists
(
$e
->
getCode
(),
static
::
$levels
))
?
static
::
$levels
[
$e
->
getCode
()]
:
$e
->
getCode
();
$severity
=
(
array_key_exists
(
$e
->
getCode
(),
static
::
$levels
))
?
static
::
$levels
[
$e
->
getCode
()]
:
$e
->
getCode
();
$message
=
rtrim
(
$e
->
getMessage
(),
'.'
)
.
' in '
.
str_replace
(
array
(
APP_PATH
,
SYS_PATH
),
array
(
'APP_PATH/'
,
'SYS_PATH/'
),
$e
->
getFile
())
.
' on line '
.
$e
->
getLine
()
.
'.'
;
$message
=
static
::
format
(
$e
)
;
if
(
Config
::
get
(
'error.log'
))
if
(
Config
::
get
(
'error.log'
))
{
{
...
@@ -50,6 +50,19 @@ class Error {
...
@@ -50,6 +50,19 @@ class Error {
exit
(
1
);
exit
(
1
);
}
}
/**
* Format the error message for a given exception.
*
* @param Exception $e
* @return string
*/
private
static
function
format
(
$e
)
{
$file
=
str_replace
(
array
(
APP_PATH
,
SYS_PATH
),
array
(
'APP_PATH/'
,
'SYS_PATH/'
),
$e
->
getFile
());
return
rtrim
(
$e
->
getMessage
(),
'.'
)
.
' in '
.
$file
.
' on line '
.
$e
->
getLine
()
.
'.'
;
}
/**
/**
* Show the error view.
* Show the error view.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment