33 private $priorFlags = [];
36 protected const MUTABLE_FLAGS = [
43 protected const DBO_MUTABLE = (
51 public function setFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
52 if ( $flag & ~static::DBO_MUTABLE ) {
54 "Got $flag (allowed: " . implode(
', ', static::MUTABLE_FLAGS ) .
')'
58 if ( $remember === self::REMEMBER_PRIOR ) {
62 $this->flags |= $flag;
65 public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING ) {
66 if ( $flag & ~static::DBO_MUTABLE ) {
68 "Got $flag (allowed: " . implode(
', ', static::MUTABLE_FLAGS ) .
')'
72 if ( $remember === self::REMEMBER_PRIOR ) {
76 $this->flags &= ~$flag;
80 if ( !$this->priorFlags ) {
84 if ( $state === self::RESTORE_INITIAL ) {
85 $this->flags = reset( $this->priorFlags );
86 $this->priorFlags = [];
88 $this->flags = array_pop( $this->priorFlags );
93 return ( ( $this->flags & $flag ) === $flag );
103 return ( (
$flags & $bit ) === $bit );
107 return $this->
getFlag( self::DBO_TRX );