1: <?php
2:
3: namespace ModHelper;
4:
5: /**
6: * @package ModHelper
7: * @since 1.0
8: */
9:
10: abstract class BitwiseFlag
11: {
12: private $flags;
13:
14: /*
15: * Note: these functions are protected to prevent outside code
16: * from falsely setting BITS.
17: */
18:
19: /**
20: * Returns the stored bits.
21: *
22: * @access protected
23: * @return int
24: */
25: protected function __construct()
26: {
27: return $this->flags;
28: }
29:
30: protected function isFlagSet($flag)
31: {
32: return (($this->flags & $flag) == $flag);
33: }
34:
35: protected function setFlag($flag, $value)
36: {
37: if ($value) {
38: $this->flags |= $flag;
39: } else {
40: $this->flags &= ~$flag;
41: }
42: }
43: }
44: