2011-05-27 15:52:26 -07:00
|
|
|
<?php
|
|
|
|
|
2012-03-13 16:21:04 -07:00
|
|
|
final class HeraldRepetitionPolicyConfig {
|
2013-08-02 12:35:33 -07:00
|
|
|
|
2011-05-27 15:52:26 -07:00
|
|
|
const FIRST = 'first'; // only execute the first time (no repeating)
|
|
|
|
const EVERY = 'every'; // repeat every time
|
|
|
|
|
|
|
|
private static $policyIntMap = array(
|
|
|
|
self::FIRST => 0,
|
|
|
|
self::EVERY => 1,
|
|
|
|
);
|
|
|
|
|
|
|
|
public static function getMap() {
|
2013-08-02 12:35:33 -07:00
|
|
|
return array(
|
|
|
|
self::EVERY => pht('every time'),
|
|
|
|
self::FIRST => pht('only the first time'),
|
|
|
|
);
|
2011-05-27 15:52:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function toInt($str) {
|
|
|
|
return idx(self::$policyIntMap, $str, self::$policyIntMap[self::EVERY]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function toString($int) {
|
|
|
|
return idx(array_flip(self::$policyIntMap), $int, self::EVERY);
|
|
|
|
}
|
2013-08-02 12:35:33 -07:00
|
|
|
|
2011-05-27 15:52:26 -07:00
|
|
|
}
|