protected function modifyUacValue($value)
{
$this->setDefaultLastValue('userAccountControl', $this->getOptions()['defaultValue']);
if (is_array($this->getLastValue())) {
$lastValue = $this->getLastValue();
$lastValue = reset($lastValue);
} else {
$lastValue = $this->getLastValue();
}
// If the bit we are expecting is already set how we want it, then do not attempt to modify it.
if ($this->fromLdap($lastValue) === $value) {
return $lastValue;
}
$value = $this->shouldInvertValue() ? !$value : $value;
$mappedValue = $this->getArrayValue($this->getOptions()['uacMap'], $this->getAttribute());
if ($value) {
$uac = (int) $lastValue | (int) $mappedValue;
} else {
$uac = (int) $lastValue ^ (int) $mappedValue;
}
return (string) $uac;
}