Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phid/type/PhabricatorPHIDType.php
| Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | if ($types === null) { | ||||
| $map = array(); | $map = array(); | ||||
| $original = array(); | $original = array(); | ||||
| foreach ($objects as $object) { | foreach ($objects as $object) { | ||||
| $type = $object->getTypeConstant(); | $type = $object->getTypeConstant(); | ||||
| if (isset($map[$type])) { | if (isset($map[$type])) { | ||||
| $that_class = $original[$type]; | $that_class = $original[$type]; | ||||
| $this_class = get_class($object); | $this_class = get_class($object); | ||||
| throw new Exception( | throw new Exception( | ||||
| "Two PhabricatorPHIDType classes ({$that_class}, {$this_class}) ". | pht( | ||||
| "both handle PHID type '{$type}'. A type may be handled by only ". | "Two %s classes (%s, %s) both handle PHID type '%s'. ". | ||||
| "one class."); | "A type may be handled by only one class.", | ||||
| __CLASS__, | |||||
| $that_class, | |||||
| $this_class, | |||||
| $type)); | |||||
| } | } | ||||
| $original[$type] = get_class($object); | $original[$type] = get_class($object); | ||||
| $map[$type] = $object; | $map[$type] = $object; | ||||
| } | } | ||||
| $types = $map; | $types = $map; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||