- md5
- 404a6649d4496f93f8a6d88ab63eec17
- sha1
- 7befcf37088a47f56aa5a59c72b505763a01c359
- sha256
- e0cb0b218e1aac61441711c9702f86266f41e5221fba3685dd184a8fd48968a7
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Ldap\Adapter\ExtLdap;
use Symfony\Component\Ldap\Exception\UpdateOperationException;
class UpdateOperation
{
private int $operationType;
private ?array $values;
private string $attribute;
private const VALID_OPERATION_TYPES = [
\LDAP_MODIFY_BATCH_ADD,
\LDAP_MODIFY_BATCH_REMOVE,
\LDAP_MODIFY_BATCH_REMOVE_ALL,
\LDAP_MODIFY_BATCH_REPLACE,
];
/**
* @param int $operationType An LDAP_MODIFY_BATCH_* constant
* @param string $attribute The attribute to batch modify on
*
* @throws UpdateOperationException on consistency errors during construction
*/
public function __construct(int $operationType, string $attribute, ?array $values)
{
if (!\in_array($operationType, self::VALID_OPERATION_TYPES, true)) {
throw new UpdateOperationException(\sprintf('"%s" is not a valid modification type.', $operationType));
}
if (\LDAP_MODIFY_BATCH_REMOVE_ALL === $operationType && null !== $values) {
throw new UpdateOperationException(\sprintf('$values must be null for LDAP_MODIFY_BATCH_REMOVE_ALL operation, "%s" given.', get_debug_type($values)));
}
$this->operationType = $operationType;
$this->attribute = $attribute;
$this->values = $values;
}
public function toArray(): array
{
$op = [
'attrib' => $this->attribute,
'modtype' => $this->operationType,
];
if (\LDAP_MODIFY_BATCH_REMOVE_ALL !== $this->operationType) {
$op['values'] = $this->values;
}
return $op;
}
}
The same content is in 24 releases, Joomla 5.4.0-rc1 to 5.4.11. See them all, or every version of this file.