protected function hasOrSet($flag, $action) { if (is_null($action)) { $result = $this->has($flag); } else { $result = (bool) $action === true ? $this->add($flag) : $this->remove($flag); } return $result; }