LdapTools\AttributeConverter\ConvertUserAccountControl::modifyUacValue PHP Метод

modifyUacValue() защищенный Метод

Given a bool value, do the needed bitwise comparison against the User Account Control value to either remove or add the bit from the overall value.
protected modifyUacValue ( boolean $value ) : integer
$value boolean
Результат integer
    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;
    }