Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893493
PhabricatorRepositoryRepositoryPHIDType.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
PhabricatorRepositoryRepositoryPHIDType.php
View Options
<?php
final
class
PhabricatorRepositoryRepositoryPHIDType
extends
PhabricatorPHIDType
{
const
TYPECONST
=
'REPO'
;
public
function
getTypeName
(
)
{
return
pht
(
'Repository'
)
;
}
public
function
getTypeIcon
(
)
{
return
'fa-database'
;
}
public
function
newObject
(
)
{
return
new
PhabricatorRepository
(
)
;
}
protected
function
buildQueryForObjects
(
PhabricatorObjectQuery
$query
,
array
$phids
)
{
return
id
(
new
PhabricatorRepositoryQuery
(
)
)
->
withPHIDs
(
$phids
)
;
}
public
function
loadHandles
(
PhabricatorHandleQuery
$query
,
array
$handles
,
array
$objects
)
{
foreach
(
$handles
as
$phid
=>
$handle
)
{
$repository
=
$objects
[
$phid
]
;
$monogram
=
$repository
->
getMonogram
(
)
;
$callsign
=
$repository
->
getCallsign
(
)
;
$name
=
$repository
->
getName
(
)
;
$handle
->
setName
(
$monogram
)
;
$handle
->
setFullName
(
"{$monogram} {$name}"
)
;
$handle
->
setURI
(
"/diffusion/{$callsign}/"
)
;
}
}
public
function
canLoadNamedObject
(
$name
)
{
return
preg_match
(
'/^r[A-Z]+|R[0-9]+$/'
,
$name
)
;
}
public
function
loadNamedObjects
(
PhabricatorObjectQuery
$query
,
array
$names
)
{
$results
=
array
(
)
;
$id_map
=
array
(
)
;
foreach
(
$names
as
$key
=>
$name
)
{
$id
=
substr
(
$name
,
1
)
;
$id_map
[
$id
]
[
]
=
$name
;
$names
[
$key
]
=
substr
(
$name
,
1
)
;
}
$query
=
id
(
new
PhabricatorRepositoryQuery
(
)
)
->
setViewer
(
$query
->
getViewer
(
)
)
->
withIdentifiers
(
$names
)
;
if
(
$query
->
execute
(
)
)
{
$objects
=
$query
->
getIdentifierMap
(
)
;
foreach
(
$objects
as
$key
=>
$object
)
{
foreach
(
idx
(
$id_map
,
$key
,
array
(
)
)
as
$name
)
{
$results
[
$name
]
=
$object
;
}
}
return
$results
;
}
else
{
return
array
(
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 18:30 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127446
Default Alt Text
PhabricatorRepositoryRepositoryPHIDType.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment