Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phid/type/PhabricatorPHIDType.php
<?php | <?php | ||||
abstract class PhabricatorPHIDType { | abstract class PhabricatorPHIDType { | ||||
abstract public function getTypeConstant(); | final public function getTypeConstant() { | ||||
$class = new ReflectionClass($this); | |||||
$const = $class->getConstant('TYPECONST'); | |||||
if ($const === false) { | |||||
throw new Exception( | |||||
pht( | |||||
'PHIDType class "%s" must define an TYPECONST property.', | |||||
get_class($this))); | |||||
} | |||||
if (!is_string($const) || | |||||
strlen($const) !== 4 || | |||||
strtoupper($const) !== $const) { | |||||
throw new Exception( | |||||
pht( | |||||
'PHIDType class "%s" has an invalid TYPECONST property. PHID '. | |||||
'constants must be a four character uppercase string.', | |||||
get_class($this))); | |||||
} | |||||
return $const; | |||||
} | |||||
abstract public function getTypeName(); | abstract public function getTypeName(); | ||||
public function newObject() { | public function newObject() { | ||||
return null; | return null; | ||||
} | } | ||||
public function getTypeIcon() { | public function getTypeIcon() { | ||||
return null; | return null; | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |