LdapTools\AttributeConverter\ConvertAccountExpiration::toLdap PHP Method

toLdap() public method

public toLdap ( $value )
    public function toLdap($value)
    {
        // A simple bool for a LDAP search requires some additional filter logic, other values can fall through...
        if ($this->getOperationType() == AttributeConverterInterface::TYPE_SEARCH_TO && is_bool($value)) {
            return $this->getQueryOperator($value);
        }
        if (!($value === false || $value instanceof \DateTime)) {
            throw new AttributeConverterException(sprintf('Expecting a bool false or DateTime object when converting to LDAP for "%s".', $this->getAttribute()));
        }
        return $value === false ? '0' : (new ConvertWindowsTime())->toLdap($value);
    }