mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 03:12:41 +01:00
b10d128c59
Summary: These class properties don't seem to be used. Test Plan: Eyeball it. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13295
22 lines
483 B
PHP
22 lines
483 B
PHP
<?php
|
|
|
|
final class PhabricatorPHID extends Phobject {
|
|
|
|
public static function generateNewPHID($type, $subtype = null) {
|
|
if (!$type) {
|
|
throw new Exception(pht('Can not generate PHID with no type.'));
|
|
}
|
|
|
|
if ($subtype === null) {
|
|
$uniq_len = 20;
|
|
$type_str = "{$type}";
|
|
} else {
|
|
$uniq_len = 15;
|
|
$type_str = "{$type}-{$subtype}";
|
|
}
|
|
|
|
$uniq = Filesystem::readRandomCharacters($uniq_len);
|
|
return "PHID-{$type_str}-{$uniq}";
|
|
}
|
|
|
|
}
|