[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 abstract class PhabricatorSystemAction { 4 5 abstract public function getActionConstant(); 6 abstract public function getScoreThreshold(); 7 8 public function shouldBlockActor($actor, $score) { 9 return ($score > $this->getScoreThreshold()); 10 } 11 12 public function getLimitExplanation() { 13 return pht('You are performing too many actions too quickly.'); 14 } 15 16 public function getRateExplanation($score) { 17 return pht( 18 'The maximum allowed rate for this action is %s. You are taking '. 19 'actions at a rate of %s.', 20 $this->formatRate($this->getScoreThreshold()), 21 $this->formatRate($score)); 22 } 23 24 protected function formatRate($rate) { 25 if ($rate > 10) { 26 $str = pht('%d / second', $rate); 27 } else { 28 $rate *= 60; 29 if ($rate > 10) { 30 $str = pht('%d / minute', $rate); 31 } else { 32 $rate *= 60; 33 $str = pht('%d / hour', $rate); 34 } 35 } 36 37 return phutil_tag('strong', array(), $str); 38 } 39 40 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |