Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18921324
PhabricatorPhurlURLPHIDType.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorPhurlURLPHIDType.php
View Options
<?php
final
class
PhabricatorPhurlURLPHIDType
extends
PhabricatorPHIDType
{
const
TYPECONST
=
'PHRL'
;
public
function
getTypeName
()
{
return
pht
(
'URL'
);
}
public
function
newObject
()
{
return
new
PhabricatorPhurlURL
();
}
public
function
getPHIDTypeApplicationClass
()
{
return
'PhabricatorPhurlApplication'
;
}
protected
function
buildQueryForObjects
(
PhabricatorObjectQuery
$query
,
array
$phids
)
{
return
id
(
new
PhabricatorPhurlURLQuery
())
->
withPHIDs
(
$phids
);
}
public
function
loadHandles
(
PhabricatorHandleQuery
$query
,
array
$handles
,
array
$objects
)
{
foreach
(
$handles
as
$phid
=>
$handle
)
{
$url
=
$objects
[
$phid
];
$id
=
$url
->
getID
();
$name
=
$url
->
getName
();
$full_name
=
$url
->
getMonogram
().
' '
.
$name
;
$handle
->
setName
(
$name
)
->
setFullName
(
$full_name
)
->
setURI
(
$url
->
getURI
());
}
}
public
function
canLoadNamedObject
(
$name
)
{
return
preg_match
(
'/^U[1-9]
\d
*$/i'
,
$name
);
}
public
function
loadNamedObjects
(
PhabricatorObjectQuery
$query
,
array
$names
)
{
$id_map
=
array
();
foreach
(
$names
as
$name
)
{
$id
=
(
int
)
substr
(
$name
,
1
);
$id_map
[
$id
][]
=
$name
;
}
$objects
=
id
(
new
PhabricatorPhurlURLQuery
())
->
setViewer
(
$query
->
getViewer
())
->
withIDs
(
array_keys
(
$id_map
))
->
execute
();
$results
=
array
();
foreach
(
$objects
as
$id
=>
$object
)
{
foreach
(
idx
(
$id_map
,
$id
,
array
())
as
$name
)
{
$results
[
$name
]
=
$object
;
}
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Nov 11, 1:59 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8329364
Default Alt Text
PhabricatorPhurlURLPHIDType.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment