2011-05-28 00:52:26 +02:00
|
|
|
<?php
|
|
|
|
|
2012-03-14 00:21:04 +01:00
|
|
|
final class HeraldRepetitionPolicyConfig {
|
2013-08-02 21:35:33 +02:00
|
|
|
|
2011-05-28 00:52:26 +02: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 21:35:33 +02:00
|
|
|
return array(
|
|
|
|
self::EVERY => pht('every time'),
|
|
|
|
self::FIRST => pht('only the first time'),
|
|
|
|
);
|
2011-05-28 00:52:26 +02: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 21:35:33 +02:00
|
|
|
|
2011-05-28 00:52:26 +02:00
|
|
|
}
|