LdapTools\Ldif\LdifParser::addModifyDirective PHP Method

addModifyDirective() protected method

protected addModifyDirective ( LdifEntryModify $entry, string $key, string $value )
$entry LdapTools\Ldif\Entry\LdifEntryModify
$key string
$value string
    protected function addModifyDirective(LdifEntryModify $entry, $key, $value)
    {
        $this->validateDirectiveInChange(LdifEntryInterface::TYPE_MODIFY, $key);
        $this->nextLine();
        if ($key == LdifEntryModify::DIRECTIVE_ADD) {
            $values = $this->getValuesForModifyAction($value, 'adding');
            $entry->add($value, $values);
        } elseif ($key == LdifEntryModify::DIRECTIVE_DELETE) {
            $values = $this->getValuesForModifyAction($value, 'deleting');
            if (empty($values)) {
                $entry->reset($value);
            } else {
                $entry->delete($value, $values);
            }
        } elseif ($key == LdifEntryModify::DIRECTIVE_REPLACE) {
            $values = $this->getValuesForModifyAction($value, 'replacing');
            $entry->replace($value, $values);
        }
    }