Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890887
DiffusionSymbolDatasource.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
DiffusionSymbolDatasource.php
View Options
<?php
final
class
DiffusionSymbolDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
isBrowsable
(
)
{
// This is slightly involved to make browsable, and browsing symbols
// does not seem likely to be very useful in any real software project.
return
false
;
}
public
function
getBrowseTitle
(
)
{
return
pht
(
'Browse Symbols'
)
;
}
public
function
getPlaceholderText
(
)
{
return
pht
(
'Type a symbol name...'
)
;
}
public
function
getDatasourceApplicationClass
(
)
{
return
PhabricatorDiffusionApplication
::
class
;
}
public
function
loadResults
(
)
{
$viewer
=
$this
->
getViewer
(
)
;
$raw_query
=
$this
->
getRawQuery
(
)
;
$results
=
array
(
)
;
if
(
strlen
(
$raw_query
)
)
{
$symbols
=
id
(
new
DiffusionSymbolQuery
(
)
)
->
setViewer
(
$viewer
)
->
setNamePrefix
(
$raw_query
)
->
setLimit
(
15
)
->
needRepositories
(
true
)
->
needPaths
(
true
)
->
execute
(
)
;
foreach
(
$symbols
as
$symbol
)
{
$lang
=
$symbol
->
getSymbolLanguage
(
)
;
$name
=
$symbol
->
getSymbolName
(
)
;
$type
=
$symbol
->
getSymbolType
(
)
;
$repo
=
$symbol
->
getRepository
(
)
->
getName
(
)
;
$results
[
]
=
id
(
new
PhabricatorTypeaheadResult
(
)
)
->
setName
(
$name
)
->
setURI
(
$symbol
->
getURI
(
)
)
->
setPHID
(
md5
(
$symbol
->
getURI
(
)
)
)
// Just needs to be unique.
->
setDisplayName
(
$name
)
->
setDisplayType
(
strtoupper
(
$lang
)
.
' '
.
ucwords
(
$type
)
.
' ('
.
$repo
.
')'
)
->
setPriorityType
(
'symb'
)
->
setImageSprite
(
'phabricator-search-icon phui-font-fa phui-icon-view fa-code '
.
'lightgreytext'
)
;
}
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:17 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125418
Default Alt Text
DiffusionSymbolDatasource.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment