3 abstract class PhabricatorSystemAction
extends Phobject
{
5 final public function getActionConstant() {
6 return $this->getPhobjectClassConstant('TYPECONST', 32);
9 abstract public function getScoreThreshold();
11 public function shouldBlockActor($actor, $score) {
12 return ($score > $this->getScoreThreshold());
15 public function getLimitExplanation() {
16 return pht('You are performing too many actions too quickly.');
19 public function getRateExplanation($score) {
21 'The maximum allowed rate for this action is %s. You are taking '.
22 'actions at a rate of %s.',
23 $this->formatRate($this->getScoreThreshold()),
24 $this->formatRate($score));
27 protected function formatRate($rate) {
29 $str = pht('%d / second', $rate);
33 $str = pht('%d / minute', $rate);
36 $str = pht('%d / hour', $rate);
40 return phutil_tag('strong', array(), $str);