@@ 102-106 (lines=5) @@ | ||
99 | */ |
|
100 | public function has($mask) |
|
101 | { |
|
102 | if (\is_string($mask) && \defined($name = 'static::MASK_'.strtoupper($mask))) { |
|
103 | $mask = \constant($name); |
|
104 | } elseif (!\is_int($mask)) { |
|
105 | throw new InvalidArgumentException('$mask must be an integer.'); |
|
106 | } |
|
107 | ||
108 | return ($this->mask & $mask) != 0; |
|
109 | } |
|
@@ 122-128 (lines=7) @@ | ||
119 | */ |
|
120 | public function resolveMask($code) |
|
121 | { |
|
122 | if (\is_string($code)) { |
|
123 | if (!\defined($name = sprintf('static::MASK_%s', strtoupper($code)))) { |
|
124 | throw new \InvalidArgumentException(sprintf('The code "%s" is not supported', $code)); |
|
125 | } |
|
126 | ||
127 | return \constant($name); |
|
128 | } |
|
129 | ||
130 | if (!\is_int($code)) { |
|
131 | throw new \InvalidArgumentException('$code must be an integer.'); |