There was an error while loading. Please reload this page.
1 parent b373787 commit 990020aCopy full SHA for 990020a
BitwiseFlagTrait.php
@@ -0,0 +1,44 @@
1
+<?php
2
+
3
+namespace App\Traits;
4
5
+/**
6
+ * Class BitwiseFlagTrait
7
+ * @package App\Traits
8
+ */
9
+trait BitwiseFlagTrait
10
+{
11
12
+ /**
13
+ *
14
15
+ protected static function bootBitwiseFlagTrait()
16
+ {
17
+ //
18
+ }
19
20
21
+ * @param $name
22
+ * @param $flag
23
+ * @return bool
24
25
+ protected function isFlagSet($name, $flag)
26
27
+ return (($this->$name & $flag) == $flag);
28
29
30
31
+ * @param string $name
32
+ * @param int $flag
33
+ * @param $value
34
35
36
+ protected function setFlag($name, $flag, $value)
37
38
+ if ($value) {
39
+ $this->$name |= $flag;
40
+ } else {
41
+ $this->$name &= ~$flag;
42
43
44
+}
0 commit comments