Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894505
PhabricatorXHPASTViewTreeController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorXHPASTViewTreeController.php
View Options
<?php
final
class
PhabricatorXHPASTViewTreeController
extends
PhabricatorXHPASTViewPanelController
{
public
function
shouldAllowPublic
(
)
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$storage
=
$this
->
getStorageTree
(
)
;
$input
=
$storage
->
getInput
(
)
;
$err
=
$storage
->
getReturnCode
(
)
;
$stdout
=
$storage
->
getStdout
(
)
;
$stderr
=
$storage
->
getStderr
(
)
;
try
{
$tree
=
XHPASTTree
::
newFromDataAndResolvedExecFuture
(
$input
,
array
(
$err
,
$stdout
,
$stderr
)
)
;
}
catch
(
XHPASTSyntaxErrorException
$ex
)
{
return
$this
->
buildXHPASTViewPanelResponse
(
$ex
->
getMessage
(
)
)
;
}
$tree
=
phutil_tag
(
'ul'
,
array
(
)
,
$this
->
buildTree
(
$tree
->
getRootNode
(
)
)
)
;
return
$this
->
buildXHPASTViewPanelResponse
(
$tree
)
;
}
protected
function
buildTree
(
$root
)
{
try
{
$name
=
$root
->
getTypeName
(
)
;
$title
=
pht
(
'Node %d: %s'
,
$root
->
getID
(
)
,
$name
)
;
}
catch
(
Exception
$ex
)
{
$name
=
'???'
;
$title
=
'???'
;
}
$tree
=
array
(
)
;
$tree
[
]
=
phutil_tag
(
'li'
,
array
(
)
,
phutil_tag
(
'span'
,
array
(
'title'
=>
$title
,
)
,
$name
)
)
;
foreach
(
$root
->
getChildren
(
)
as
$child
)
{
$tree
[
]
=
phutil_tag
(
'ul'
,
array
(
)
,
$this
->
buildTree
(
$child
)
)
;
}
return
phutil_implode_html
(
"\n"
,
$tree
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:59 (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128234
Default Alt Text
PhabricatorXHPASTViewTreeController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment