Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phid / storage / PhabricatorPHID.php
blobf47d3c819f28a8dc24b97f44e78ce319e6da0b05
1 <?php
3 final class PhabricatorPHID extends Phobject {
5 public static function generateNewPHID($type, $subtype = null) {
6 if (!$type) {
7 throw new Exception(pht('Can not generate PHID with no type.'));
10 if ($subtype === null) {
11 $uniq_len = 20;
12 $type_str = "{$type}";
13 } else {
14 $uniq_len = 15;
15 $type_str = "{$type}-{$subtype}";
18 $uniq = Filesystem::readRandomCharacters($uniq_len);
19 return "PHID-{$type_str}-{$uniq}";