Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
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
PSDI Army
yii2
Commits
cf0d582a
Commit
cf0d582a
authored
Jan 15, 2015
by
Brandon Kelly
Committed by
Alexander Makarov
Jan 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added yii\web\ErrorHandler::getTypeUrl()
Makes it possible for classes that extend yii\web\ErrorHandler to provide their own informational URLs for types/classes/methods.
parent
a6dd9d37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
ErrorHandler.php
framework/web/ErrorHandler.php
+22
-3
No files found.
framework/web/ErrorHandler.php
View file @
cf0d582a
...
@@ -173,20 +173,39 @@ class ErrorHandler extends \yii\base\ErrorHandler
...
@@ -173,20 +173,39 @@ class ErrorHandler extends \yii\base\ErrorHandler
$text
=
$this
->
htmlEncode
(
$class
)
.
'::'
.
$this
->
htmlEncode
(
$method
);
$text
=
$this
->
htmlEncode
(
$class
)
.
'::'
.
$this
->
htmlEncode
(
$method
);
}
else
{
}
else
{
$class
=
$code
;
$class
=
$code
;
$method
=
null
;
$text
=
$this
->
htmlEncode
(
$class
);
$text
=
$this
->
htmlEncode
(
$class
);
}
}
if
(
strpos
(
$code
,
'yii\\'
)
!==
0
)
{
$url
=
$this
->
getTypeUrl
(
$class
,
$method
);
if
(
!
$url
)
{
return
$text
;
return
$text
;
}
}
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$text
.
'</a>'
;
}
/**
* Returns the informational link URL for a given PHP type/class.
* @param string $class the type or class name.
* @param string|null $method the method name.
* @return string|null the informational link URL.
* @see addTypeLinks()
*/
protected
function
getTypeUrl
(
$class
,
$method
)
{
if
(
strpos
(
$class
,
'yii\\'
)
!==
0
)
{
return
null
;
}
$page
=
$this
->
htmlEncode
(
strtolower
(
str_replace
(
'\\'
,
'-'
,
$class
)));
$page
=
$this
->
htmlEncode
(
strtolower
(
str_replace
(
'\\'
,
'-'
,
$class
)));
$url
=
"http://www.yiiframework.com/doc-2.0/
$page
.html"
;
$url
=
"http://www.yiiframework.com/doc-2.0/
$page
.html"
;
if
(
isset
(
$method
)
)
{
if
(
$method
)
{
$url
.=
"#
$method
()-detail"
;
$url
.=
"#
$method
()-detail"
;
}
}
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$text
.
'</a>'
;
return
$url
;
}
}
/**
/**
...
...
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