setAncestorClass(__CLASS__) ->loadObjects(); $map = array(); foreach ($objects as $object) { $key = $object->getAutoplanPlanKey(); if (!empty($map[$key])) { $other = $map[$key]; throw new Exception( pht( 'Two build autoplans (of classes "%s" and "%s") define the same '. 'key ("%s"). Each autoplan must have a unique key.', get_class($other), get_class($object), $key)); } $map[$key] = $object; } ksort($map); $plans = $map; } return $plans; } }