[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phid/storage/ -> PhabricatorPHID.php (source)

   1  <?php
   2  
   3  final class PhabricatorPHID {
   4  
   5    protected $phid;
   6    protected $phidType;
   7    protected $ownerPHID;
   8    protected $parentPHID;
   9  
  10    public static function generateNewPHID($type, $subtype = null) {
  11      if (!$type) {
  12        throw new Exception('Can not generate PHID with no type.');
  13      }
  14  
  15      if ($subtype === null) {
  16        $uniq_len = 20;
  17        $type_str = "{$type}";
  18      } else {
  19        $uniq_len = 15;
  20        $type_str = "{$type}-{$subtype}";
  21      }
  22  
  23      $uniq = Filesystem::readRandomCharacters($uniq_len);
  24      return "PHID-{$type_str}-{$uniq}";
  25    }
  26  
  27  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1